LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-24-2006, 06:24 PM   #1
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Rep: Reputation: 30
compling for java 1.4.2 using java 1.5


I use java 1.5 because of azureus but my university uses 1.4.2. I s there a way I can compile program i've built using 1,5 to work on 1,4,2. Occsionally I get errors from the compiler saying it cant recognise classes when they are in the same package. This only happens if I've compiled it using 1.5.
 
Old 02-24-2006, 06:34 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Are you using eclipse as your IDE? You can select how you want code compiled and there's a heap of options for 1.4 and 1.5. I don't even bother trying to remember them now, I just make sure it compiles and then let maven take care of the build/test/deploy stuff.
 
Old 02-24-2006, 06:34 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Sure:
Code:
javac -source 1.4 MyProg.java
 
Old 02-25-2006, 04:17 AM   #4
linuxmandrake
Member
 
Registered: Sep 2004
Distribution: debian sarge 64bit (AMD)
Posts: 709

Original Poster
Rep: Reputation: 30
ah sorry I use netbeans
 
Old 02-25-2006, 11:46 AM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
It totally doesn't matter if you use NetBeans or Eclipse or the command line:

1. "Under the covers", Netbeans and Eclipse both use the command line "javac".

2. You, too, must be familiar with the command line (even if you choose not to use it).

3. Knowing about "-source <version>" (by typing "javac -help" ... or reading
the previous post), then you know what to change in the IDE.

4. In the NetBeans 4.1 IDE, for example, you can do this:
[Project Window],
<Right Click>MyProject,
Properties..., Build, Compile,
Additional compiler options: "-source 1.4"
 
Old 02-25-2006, 12:26 PM   #6
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
Quote:
Originally Posted by linuxmandrake
ah sorry I use netbeans
Look at the project properties(right-click on the project node), you can specify the source level(ie 1.5 or 1.4)
 
Old 02-25-2006, 01:06 PM   #7
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
That's an excellent example of the problem with just blindly following IDEs, instead of also having at least some familiarity with the command-line equivalent: some stuff is in this GUI, other stuff is in the other GUI, and a lot of stuff isn't in any GUI whatsoever.

My original advice still stands:
1. Spend 30 seconds in a command prompt and familiarize yourself with "javac -help" and "java -help" compile and execute options

2. Use the "Project, Properties, Additional Compiler options" for *all* of your custom flags.

It's less you have to rememeber,
It insures all your custom settings will be "documented" in one place
It ALSO lets you handle OTHER options that the GUI DOESN'T happen to provide

IMHO .. PSM
 
Old 02-25-2006, 02:16 PM   #8
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
I don't blindly follow anything - it comes down to where the complexity in the environment is. When you have multiple developers, all contractors so turnover is high, you set up the environment to minimise the cost of getting someone up to speed.

Here, that means an IDE configured by default to use the correct settings and CVS repository, automated build/test and deployment tools (Ant, JUnit and Maven) and documented procedures for using them all. The developer checks out the code for the project they're working on, does the work according to the spec they're given, uses the build tools to check it builds and passes the tests and checks it back into CVS. All through the preconfigured IDE. The test team export it from CVS, deploy it using maven, run the system tests and report to me.

This way, I'm responsible for 5 developers, 300,000+ lines of code (not huge, but it's still fun) and we all get to have a lunch hour instead of arguing over which command line switches provide the best tweak. The only time we've talked about command line switches on the last 3 of my projects is at the start when we set up the environment so the developers don't have to.
 
Old 02-25-2006, 02:42 PM   #9
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hey, gilead - I wasn't criticizing you. In fact, I think we're in complete agreement.

You *don't* "empower" somebody by telling them about some stupid checkbox nested 5 levels deep in a menu that's going to be in a completely different place in the next version anybody, and then stopping there.

On the one hand, we (the developers) *know* what the checkbox means: so we can *find* it in that hypothetical next release of the IDE, or we can work around it if the IDE doesn't happen to support it.

On the other hand, we (the project leads/project managers) set up the configuration - DOCUMENT and BASELINE that configuration, and whether it's a checkbox or a command switch is irrelevant. Because everything "just works", as far as the developer is concerned.

Again:
Quote:
My original advice still stands:
1. Spend 30 seconds in a command prompt and familiarize yourself with "javac -help" and "java -help" compile and execute options

2. Use the "Project, Properties, Additional Compiler options" for *all* of your custom flags.

It's less you have to rememeber,
It insures all your custom settings will be "documented" in one place
It ALSO lets you handle OTHER options that the GUI DOESN'T happen to provide
 
Old 02-25-2006, 03:01 PM   #10
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
My apologies paulsm4, I'd like to blame lack of coffee here (Sunday morning in Australia)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Java plugin installed correctly for Firefox but not able to view any java applet tvn Linux - Software 10 04-15-2010 02:13 AM
Synaptic Package Manager shows 'java-common' and 'java-gcj-compat' as Installed. swiadek Ubuntu 3 02-12-2006 11:54 AM
JAVA JRE installation to view java applet through browser dipenchaudhary Linux - Software 1 01-23-2006 09:20 AM
Web start java not working (java works fine) powadha Debian 5 06-05-2004 12:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration