Shell script Problem in JAVA programing
Hey all,
I usually code and compile using a shell like Textpad or Netbeans, but have recently been trying to feed the command line some simple commands.
Unfortunately it responds to my Javac commands by saying:
C:\Java\MP1>javac BgArray.java
'javac' is not recognized as an internal or external command,operable program or batch file.
Does anyone know how to solve this? The editor-programs have no problem compiling and running Java.
Thanks!!
Re: Shell script Problem in JAVA programing
Hi, thanks for dropping by!
This is not a web application. So you don’t need Tomcat. Just compile and run it from the command line. The readme file has commands for windows. On Unix, replace ; with : and \ with /.
Code:
$ javac -cp lib/smack.jar:lib/smackx.jar:lib/smackx-debug.jar ChatClient.java
$ java -cp lib/smack.jar:lib/smackx.jar:lib/smackx-debug.jar:. ChatClient
have put comments where you need to provide your Look at the main method of ChatClient.java.
Hope this helps.
PS: This is just a command line sample to get you started. There is no fancy UI.
Re: Shell script Problem in JAVA programing
Thanks for providing the code in your blog. it gives the good understanding of basics.
I am facing a strange issue !!
On running the code in my machine, I am able to chat with my userID as both sender and receiver (in console, as just echo program). However, while chatting with another are reaching the reveiver to thier replys are not displayed in my console.
I can see the reply packets are received in the degugger window, but processMessage() of MessageListener is not getting invoked in this case.
The same problem occurs, even with my local Openfire installed in my machine.
Please provide me some insight on this issue.
Thanks,
Re: Shell script Problem in JAVA programing
Your PATH env.var. does not include the path to javac.exe
You can either explicitly name javac.exe
Code:
C:\foo\bar\> C:\j2sdk1.4.2_01\bin\javac Filename.java
or add the path and just use javac
Code:
C:\foo\bar\> set PATH=%PATH%;C:\j2sdk1.4.2_01\bin
C:\foo\bar\> javac Filename.java
Replace C:\j2sdk1.4.2_01 with the actual path to bin\javac.exe