• Post Reply Bookmark Topic Watch Topic
  • New Topic

Editing/running/compiling Java source code offline  RSS feed

 
John Gross
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a newcomer to Java, though I have been involved in IT since 1970 and have achieved some competence in more than ten programming languages over that period.

I have some Java open source code that I would like to make some small changes to, and use the resulting application privately... on a laptop that is almost never online.

I downloaded Java from the Oracle website and installed it on that laptop, but every time I tried to do something - specifically, get some help for what I want to do - it tried to connect to a website... without success, of course.

My question is: is it possible to work with Java offline; and if so, can anyone suggest how I should go about this?
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

That is absolutely possible. In fact, your statement has me baffled, because there's nothing in the normal development cycle that would need for you to be online. Can you elaborate ion what, exactly, you're doing, and what, exactly, happens as a result? Post the actual commands and error messages.

There are build systems -like Maven- that rely on being online to download additional libraries; it almost sounds like what that might do.
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, John!

John Gross wrote:- specifically, get some help for what I want to do - it tried to connect to a website...

It looks like you're using an IDE, aren't you? In this case, it should be possible to configure the IDE to use downloaded, off-line version of the help files (I'd suggest posting a new question in our IDE forum specifying the concrete IDE you're using if you need help with that).

IDEs usually try to display the javadoc for the class or method under the cursor. The javadoc can be downloaded for offline browsing from the usual places. I also believe the official Java tutorials are an excellent resource, and it looks like they can be downloaded for offline browsing too (though I haven't tried it myself).
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Martin Vajsar wrote: . . . I also believe the official Java tutorials are an excellent resource, and it looks like they can be downloaded . . .
Yes, available here. You download the .zip file, unzip it and point your browser at one of the index files.
 
John Gross
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for your prompt reponses.

I installed - apparently successfully - what I understood to be the appropriate software into c:\Program Files\Java\jdk1.7.0_51.

I was surprised that no shortcut appeared on the desktop, but I navigated into ...jdk...\bin and found java.exe. I clicked on this and what appeared to be a "startup" window appeared. Not knowing what I needed to do next - I wanted to see if I could compile (if that's the right word for Java) the open source application I had already downloaded into its .jar form - I clicked on Help in the menu bar.

The result was that IE came up with the message that the relevant page could not be found.

It seemed to me that access to the Help facility depends on being online, but that would make things very awkward for what i am trying to do, so I submitted my above enquiry.

After reading the first two responses, I went back to the offline laptop to get more detailed information, but I was unable to reproduce the problem.

Now, when I click on java.exe, all that happens is a momentary appearance of a window that looks like the Command Prompt, but this vanishes too quickly to be sure. Otherwise... nothing.

It occurred to me that perhaps - even if running Java applications offline is possible - it may be necessary to be online to do the other things - editing/testing/compiling the Java source - I want to do. This would be a nuisance, but I could live with it.

So... I tried installing the Java DK on my online PC. The installation itself looked very much like what I had seen on the offline PC - with some differences that I didn't understand - but when I tried to launch java.exe, I got exactly the same results.

It's now looking to me as if my problem has more to do with the installation of Java than what I thought it did... so, unless any of you have other suggestions, perhaps I should raise my issue as a more appropriate topic.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You usually open a command prompt window and write the instruction there. Of course if you haven't set a PATH, you get the top error message shown here.
I am not quite sure I know what is going on, but have you run any Java® programs at all?
 
John Gross
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Campbell.

I had foolishly assumed that there would be a GUI for doing the editing/compiling etc in Java!

With your pointer in the right direction, I was finally able to find out a little more about the .jar I have - along with a multi-level directory containing .java source and other stuff.

I discovered that the .jar only approximates what is the source directories - there are things in the manifest of the .jar that I can't find in the directories, and vice versa - so at the moment I can't see how I can possibly work out how to make the minor changes that I would like to.

I apologise for taking up the time you all took to try to help me.
 
Tony Docherty
Bartender
Posts: 3271
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had foolishly assumed that there would be a GUI for doing the editing/compiling etc in Java!

There are free IDE's available such as Eclipse, Netbeans etc or you can just use a text editor to edit the files and then recompile them from the command line.

I discovered that the .jar only approximates what is the source directories - there are things in the manifest of the .jar that I can't find in the directories, and vice versa

It may be the application you have relies on other 3rd party libraries that you also need to download. If you post the contents of the manifest we may be able to help you further.
 
Campbell Ritchie
Marshal
Posts: 56525
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Gross wrote:Thank you, Campbell. . . . I apologise for taking up the time you all took to try to help me.
You're welcome and there is nothing to apologise for.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!