LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-29-2008, 10:35 AM   #1
nano2
Member
 
Registered: May 2007
Posts: 100

Rep: Reputation: 15
platform conditional for JAVA


Hi ,

I have noticed when using a different java SDK implementation for different platforms the packages are different .
so in c/C++ I can use this if code was different but need to do something similar with my java app.
#ifdef PLATFORM

#else

#endif

How can i achieve the same behaviour within my java application ? ..

Appreciate your help here .
thanking you


so i need to have a platform con
 
Old 04-30-2008, 03:13 AM   #2
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
You can query the platform using System.getProperties() to see all of the details or use just System.getProperty("os.name"). The former produces a Properties object that you can send to an outputstream using the list() method; the latter produces a String that you could compare to determine the appropriate action:
if ((System.getProperty("os.name")).equals("Linux"))
//CODE
 
Old 05-01-2008, 03:15 AM   #3
nano2
Member
 
Registered: May 2007
Posts: 100

Original Poster
Rep: Reputation: 15
Thanks Jay !
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I get platform specific info in Java devn Programming 5 10-15-2007 12:51 AM
installing Java platform mattcantgetsome Linux - Newbie 1 03-18-2007 04:14 AM
LXer: Java 6 Platform Revealed LXer Syndicated Linux News 0 08-24-2006 02:54 AM
Replaciing java platform by Sun's Java platform machan Linux - Newbie 1 11-11-2005 01:55 AM
java platform problems, JTabbedPane darkRoom Programming 5 10-15-2004 04:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:58 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