Page 1 of 1

Java Compiling/Running in TextPad

Posted: Wed Nov 05, 2003 10:09 pm
by JediSange
Well, I'm taking a programming class at school. There we use TextPad. We all love it *Pats developers on backs*.

Anyhow, in TextPad we just hit Control + 1 to compile our code, then control + 3 to run the applet. I downloaded the JVM (Java Virtual Machine). I have the most latest version, 1.4.2 or something. So then I installed TextPad. Now I go there... and it doesn't allow me to compile. Any help would be great. Thanks in advance!

Posted: Wed Nov 05, 2003 10:36 pm
by talleyrand
Ensure that you have installed the Java SDK on your home machine. Configure -> Preferences (ctrl-Q, P) Tools, Add Java SDK Commands. Now, that will probably assign them as 1 and 2. Not sure what your school has 2 set for. If you must have it as 3, back in your preferences menu take a gander at Keyboard, Tools, and then assign whatever keystroke you'd like.

Oh and don't forget to register TP. Keith likes kudos but I suspect he doesn't object to money.

Posted: Wed Nov 05, 2003 10:37 pm
by JediSange
Ok... I figured a little bit out.

I went to Configure > Preferences > Tools and enabled the Java SDK Commands. But then when I go to compile it says it cant find C:\WINDOWS\System32\javac.exe.

Any ideas?

Posted: Thu Nov 06, 2003 3:09 am
by talleyrand
Not to be difficult, but you have installed java on your machine, yes? If you hit Start -> Run and type Command (unless cmd works) it will give you a command prompt. type java -version. This will tell you what version of the Java Runtime Environment you have. Assuming that works, type javac. That ought to bring up the command line parameters of javac.

If that did not happen, then you'll probably need to find where the java SDK is installed at on your machine and do some magic. To find it, at the command prompt type cd \ That will point you at the root of your drive. Type dir /s javac.exe It ought to find something like
C:\j2sdk1.4.1_01\bin\javac.exe I would test that everything works fine from the command line---so assuming the executible is where I found it and my code is in c:\sandbox\Test.java, I'd do something like this
c:\>\j2sdk1.4.1_01\bin\javac.exe \sandbox\Test.java and see what happens. If that compiles, then you know your java installation is fine. If it doesn't, then you most likely have a java problem. It's been quite some time since I've been deep into Java so I don't know if you still need to set classpath environmental variables or not.

If the dir /s javac.exe found nothing File Not Found then you need to go to Sun and download a copy of the SDK. You might need to kill out the Java tools on the TP install and redo them, not sure on that.

If it compiles fine on the command line but not in TP, then I'd go and make a new Tool but hand code the info. Configure, Preferences, Tools, Add, Program, File Name is going to be where the javac executible is. Parameters is $File, Initial Folder is $FileDir, Check capture output and Sound alert when completed. Reg Exp to capture is ^\(\(\(.[^:]\)\|\([A-Za-z]:\)\)[^:]+\):\([0-9]+\):
Registers: File = 1, Line = 4, Column = Blank

See where that gets you.

Oh, and check out johnr's kick-ass write-up.