Run Tool not working?

Using the Java SDK with TextPad

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

Post Reply
Yencanwasu
Posts: 4
Joined: Thu Sep 17, 2009 11:24 pm

Run Tool not working?

Post by Yencanwasu »

Oddly enough, I have Java SDK 6.* installed yet the tools were not automatically found. I manually added these two tools, seperately, namely used Add > Program and then searched for javac and java and added them.

The Compile tool works, but the Run tool does not. I think I know why but im not 100 percent sure:

Here is the run down:

I get this error and I notice some things:

java.lang.NoClassDefFoundError: C:\Documents and Settings\Chris\Desktop\test/java
Caused by: java.lang.ClassNotFoundException: C:\Documents and Settings\Chris\Desktop\test.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: C:\Documents and Settings\Chris\Desktop\test.java. Program will exit.
Exception in thread "main"
Tool completed with exit code 1

FIRST: its says the tool is looking for test.java. , which is obviously not what it should be looking for; it should be looking for test.class

I think the way to fix this would be to put the correct command in the tool parameters text box, though I dont know what that is:
Currently, under Prefences > Tools > Java Run (what i named it) and in the parameters text box it says $File.

If you have the tools working, could you tell me what command you have in the parameters text box? thanks
Last edited by Yencanwasu on Tue Sep 22, 2009 10:07 pm, edited 1 time in total.
Yencanwasu
Posts: 4
Joined: Thu Sep 17, 2009 11:24 pm

Tools > Run...

Post by Yencanwasu »

For those that are having the same problem and still want to use this GUI. Here is a solution that takes about 2 seconds longer than if you could use the Tool:

Go to the Tools menu, and select Run...

Make sure the dos command checkbox is selected, and then type "java"(without quotations) in the "Command:" textbox, then in the parameters textbox type the name of your class that contains the main method.

As I typed this I just found out what the error is because I get the same error if i use the Run... dialog box and type .class after the name. You can use the tool if you enable prompt for parameters and remove the $File command and replace it with the name of you class that contains the main method; though the output will not open a command window but will display it in the "tool output" in textpad instead.

NOTE: if you use the method i explained above(Tools > Run...), just type the name of the class, without its extension otherwise it will not work.

Hope this was helpful!

If anyone has information on how to make the java command tool work as a Tool, namly set up its parameters etc. in the Configure > Prefrences > Tools > (the name you gave the Tool), this would still be helpful for others im sure, and I would like to know. Thanks!
Last edited by Yencanwasu on Sun Sep 20, 2009 6:23 am, edited 1 time in total.
Yencanwasu
Posts: 4
Joined: Thu Sep 17, 2009 11:24 pm

Make Tool program output run in Command Prompt

Post by Yencanwasu »

Previously I explained the way you can get around the problem that I figured out by limited knowledge and messing.

I now just found out that you can make the Tool output in a Command Prompt window unlike i said earlier.

To do this all you need to do is un check the Capture output checkbox, and now the only difference in your Tool than if it was supplied by text pad is you have to type the name in the parameters popup when you click the tool and the Command window closes itself. Though you can fix this aswell by unchecking the Close dos window on exit checkbox. You still have to type the name of the class to run(without its extension).

Well it looks like I almost figured this out myself, so for those who would like a step by step here it is:

NOTE: The only difference if you do it this way, is you have to type the name of the class that contains the main method(without its extension) when you click the Tool.

IF YOU ARE A PERSON WHO DOESNT HAVE THE RUN TOOL FOR JAVA IN TEXTPAD OR IT ISNT WORKING WITH TEXTPAD HERE IS WHAT YOU CAN DO:

1. Go to Configure in the menu.
2. Go to Prefrences...
3. Go to Tools
4. Click Add and select Program...
5. Add java.exe
6. Rename it if you like
7. Push the plus sign next to Tools to show each tool, then select the name you gave java.exe
8. Remove the parameters
9. Check the Prompt for Parameters checkbox
10. Uncheck the Capture output checkbox
11. Uncheck the Close dos window on exit checkbox

It will work now.

All you do is when you want to run your program:
1. Click the Tool
2. Type the name of the class containing the main method
3. Press OK
Post Reply