aspose file tools*
The moose likes Java in General and the fly likes Compiling on a network. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Compiling on a network." Watch "Compiling on a network." New topic
Author

Compiling on a network.

Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
Hi guys!
I have two machines... one is slow and other being fast(as per their configuration). I want to write code on the slower one and dump the compilation overhead on the other machine which can do it faster. Is it possible??? Any suggestions... ideas...

Ofcourse the two are connected through LAN.
Thanks in advance. Catch you after dinner. :-)


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
Yes of course its possible.
Sounds like a client/server application.
On the client, send the source to the server.
On the server, receive the source, run the compile program with options as required, capture the Screen output and send it and the .class files (if any) back. If importing, you'll need to make sure that the correct jar/class files are on the server and that the classpath for the compile is set and also any other compiler options that you need.
Will need some way to keep the class/jar files upto date.
Back on the client, receive the results and save as needed.

Sounds like an interesting project.
Good luck.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
Oh no NORM you misunderstood me...

I want to have .java file on this machine and comiplation should run on the other machine. That is J2SE should be installed on the remote(faster) machine, and i must edit the .java file and make corrections on the local(slower) machine.

I am not talking about the client-server application... I want to know if the "javac" command itself can be run as client-server application. That is j2se on remote machine but executing it from a local machine.


And if it is not possible, i would better compose the project on the remote machine itself.

Thanks.
[ August 23, 2005: Message edited by: Akhil Trivedi ]
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
Sure, just set the -sourcepath to your slow machine from the fast one and run the compile from the fast machine. Set the -d switch to dump class files back on your slow machine where you are running.

The wrinkle is you need a remote command window. Trivial and natural on UNIX but a little heavier on Windows. I think what you really wanted was a remote javac proxy. Not aware of any.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
I think what you really wanted was a remote javac proxy.


Exactly Ricko'O. I could get your ideas... thanks a lot. Bottleneck is I simply want J2SE on remote machine, and that's it... i dont want to touch it again later.

If I had to sit on the remote (faster)machine and type "javac" there, then why should I not write .java code also then and there itself???


I am tied up with a slow machine, i can not leave it... so, I will write the code here, but since my machine is not fast enough to run java compiler with ease... i want to dump that part on a remote machine (where I assume that i would install j2se).

Question is... can i run "javac" remotely??? Is there any possibility???

[ August 23, 2005: Message edited by: Akhil Trivedi ]
[ August 23, 2005: Message edited by: Akhil Trivedi ]
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
Sorry, I don't see how this is related to Java programming? Seems like a network or OS problem.
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1527
Its not a network/OS problem NORM... also, I agree its not a question related to programming, and if it were to be a programming question, it would never have been here. Yes, it would not have been here because I would have channelised it into even more specfic threads than hanging it in a general thread of this kind. And I tell you, it was only after hunting all the available forums here at javaranch.com I found this (java in general (advanced)) as the only place, where my query could fix in.

I am not asking network troubleshooting of Win2000 or protocol-configurations in linux, its all about capabilities/variations of using "javac". And as long as i talk of javac its going to mean java, i guess.


I may seem harsh, but i want to clear my stand norm, and please there is nothing to ask sorry for. Have a nice day dude. ;-)
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

You could have .java and .class - files shared via 'shared direcotries' or what it's called in the windows-world - we're talking about windows, right? - . so it is accessible from the fast machine.

Then you could write a small rmi-client and server, so that you start the server on the fast machine - preferably via autostart if using it often - and starting the client, which accepts a compilation - command, which is send to the fast machine, which invokes it, grabs the output, and sends it back.


http://home.arcor.de/hirnstrom/bewerbung
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
I have network cards in my two PCs here at home. Both use Win98. I can share directories between them. I do it in Windows Explorer: Tools|Map Network drive... I have run programs on one computer that read and write on the other. No big deal.
The problem in your case would be to start the javac.exe program on the other computer wiht the desired options and have it capture and write the console log with the error messages to a disk on your system. The I/O for reading source and writing class files would be normal windows directory references.
That implies perhaps a client-server relationship.

Other fancier options would be for the "network" to support a console on the slow machine for the task running on the fast machine. I've heard of this, and had it on an IBM system I worked on, but have not seen it on PCs.

Don't ride your horse too hard.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

With linux, I would use nts to share the files, and open a ssh-terminal session to the faster machine, and would see all output (success-messages) on the client directly.

On Windows, you share may share Folders, but there is a ssh/ sshd-Solution too, isnt't it?

For compiling from an IDE like eclipse, some more work has to be done, that's why I thought about RMI, but eclipse is allways compiling small pieces of code in time, so I don't even recognize compiling-..,
Jayesh Lalwani
Ranch Hand

Joined: Nov 05, 2004
Posts: 502
Are both the machines WIndows? Do you have dedicated use for both machines?

If both are Windows and you have dedicates ude of both machines, you can use programs like VNC Viewer and PCAnywhere. You need to install the VNC Viewer server on the faster machine, and client on your slower machine. You can place your files on a shared network drive, and install javac on the faster machine. Using VNC viewer you can take control of the faster machine from the slower machine. WHen you start your VNC client and connect to the faster machine, you can see the desktop of the faster machine in the VNC client window. VNC client will take all your mouse and keyboard commands and send it to the server, and the server will duplicate your mouse and keyboard commands. You can get VNC here http://www.realvnc.com/
Norm Radder
Ranch Hand

Joined: Aug 10, 2005
Posts: 687
    
    1
Some how that doesn't sound like Java programming.
Interesting though.
Rick O'Shay
Ranch Hand

Joined: Sep 19, 2004
Posts: 531
The problem is that if you are on snail and open a shell to speedy the problems vanish: use command line switches to point to source and target folders mounted on the network. The small program to call javac has little motivation but it's certainly doable.
 
Consider Paul's rocket mass heater.
 
subject: Compiling on a network.