Textpad + Java 64 bit for windows 7 (unique problem)

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
darethas
Posts: 5
Joined: Mon Mar 22, 2010 6:50 am

Textpad + Java 64 bit for windows 7 (unique problem)

Post by darethas »

Hi, I read over many Textpad and java threads for windows 7 and noticed most of them had the same problem: "Whoops, forgot to point to the tools myself!"

I reguard myself as highly advanced in the ability to use computers and figure things out, however I myself, including my instructor are stumped here as to why I cannot get Textpad to RUN programs on my system. Please take note that I am able to COMPILE them because I properly pointed to the javac in the /bin folder. However, when I attempt to run the .java file that I recently compiled, I always recieve this same exact error.
ava.lang.NoClassDefFoundError: C:\Users\Dimitri\Desktop\Test/java
Caused by: java.lang.ClassNotFoundException: C:\Users\Dimitri\Desktop\Test.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: C:\Users\Dimitri\Desktop\Test.java. Program will exit.
Exception in thread "main"
Tool completed with exit code 1
Mind you,I have....:
a.) written my code propery (just a simple System.out.println statement, )
b.) named the .java file the same as my public class in the same case and everything.
c.) even tried modifiing the enviroment variables (albeit not sure if it is exactly right, I have indeed tried it, within textpad, and actually through windows.)

So, me and my Java instructor are stumped. Once again I am aware of what that exception means, and do not understand why it is happening. I am able to COMPILE but not RUN. Please help.
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Do you receive the same results if you attempt to run the java application from the command line? Actual location of java.exe will depend on your version but approximately this.

C:\>"C:\Program Files\Java\jre6\bin\java.exe" C:\Users\Dimitri\Desktop\Test
I choose to fight with a sack of angry cats.
darethas
Posts: 5
Joined: Mon Mar 22, 2010 6:50 am

Post by darethas »

Yes the same thing happens.

By the way you had it right with the location and everything too
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Out of curiosity, are you running

C:\>"C:\Program Files\Java\jre6\bin\java.exe" -verbose C:\Users\Dimitri\Desktop\Test

or are you running

C:\>"C:\Program Files\Java\jre6\bin\java.exe" -verbose C:\Users\Dimitri\Desktop\Test.java

Based on your error message, I now suspect the latter. Look at your error message, it indicates class not found for class Test/java

I'm sure you know this but I'm spelling it out here for future people searching on this issue.

Java compilation (javac) takes your source (.java) file and creates a binary output (.class) The syntax for doing so would be "javac MyCode.java"

Running a java program involves spinning up the Java application launcher (JVM) via the java command. The argument for this is the name of the java class file without the file extension. "java MyCode"
I choose to fight with a sack of angry cats.
darethas
Posts: 5
Joined: Mon Mar 22, 2010 6:50 am

Post by darethas »

I am compiling first then pointing to the .java to run the program. I am actually testing out with other programs and having no issues, such as jGRASP. I don't understand I keep playing with the settings hoping to find a solution but nothing is working
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

Ah, but you don't want to point at the .java to run. You want to point at the compiled object, the .class file (but do not supply the .class extension)

Configure
Preferences...
expand Tools, find Run Java Application
Command = java.exe
Parameters = $BaseName
Initial folder = $FileDir

This would perform the same steps if you were to run the following from the command line.
C:\>"C:\Program Files\Java\jre6\bin\java.exe" C:\Users\Dimitri\Desktop\Test
I choose to fight with a sack of angry cats.
clewis
Posts: 3
Joined: Tue Oct 19, 2010 12:51 pm

Post by clewis »

Thanks dude - work for me. Had same problem.
Post Reply