LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 01-14-2008, 05:31 AM   #1
alrawab
Member
 
Registered: Dec 2002
Location: Libya
Distribution: RHLE 5 + slackware 12
Posts: 60

Rep: Reputation: 15
c/c++ 2 java


hey

i'm new in java I would like to convert my c++ progarmes to java
but I faced some proplem because most of my programes linked to c/c++ libs as will as use the headers of these libs .
any one can help to make port for some c/c++ libs to java
thnx
BR,
SIS
 
Old 01-14-2008, 06:32 AM   #2
Zmyrgel
Senior Member
 
Registered: Dec 2005
Location: Finland
Distribution: Slackware, CentOS, RHEL, OpenBSD
Posts: 1,006

Rep: Reputation: 37
I too am new to Java but I would think that most libraries are ported to Java. If not you could check if Java has some standard library solution for it already.
 
Old 01-14-2008, 06:39 AM   #3
alrawab
Member
 
Registered: Dec 2002
Location: Libya
Distribution: RHLE 5 + slackware 12
Posts: 60

Original Poster
Rep: Reputation: 15
hey
i dont talking about standred lib for example if used rpm or parted lib in my original c++ pro
how can i link to them from java (using of headers and dynamic linking of libs )
thnx for replay
BR,
SIS

Last edited by alrawab; 01-14-2008 at 06:40 AM.
 
Old 01-14-2008, 10:02 AM   #4
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
In Java you can define a class property as "native" meaning it refers to a piece of native code (ie. C, C++ - non-Java).

I've never used this, though, and have no idea as to how to incorporate it. Google searching should be able to help you with this, though.
 
Old 01-14-2008, 10:40 AM   #5
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
http://en.wikipedia.org/wiki/Java_Native_Interface - be aware that such programs are not portable like java is.
 
Old 01-15-2008, 03:50 AM   #6
alrawab
Member
 
Registered: Dec 2002
Location: Libya
Distribution: RHLE 5 + slackware 12
Posts: 60

Original Poster
Rep: Reputation: 15
Thank you guys for replaying … I Don't traying such techinque but I think this may be heavy and may cause dealying .
I Meant how to convert C/C++ LIBS To Native JAVA Class
(I SAW SOME THING LIKE THAT IN PYTHON "you can see source code of parted for example you will find python dir check it ") and Dealing with them as java class .
THNX
BR,
SIS

Last edited by alrawab; 01-15-2008 at 03:57 AM.
 
Old 01-15-2008, 08:48 AM   #7
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Really, I've run into situations like this before, where I would to make use of a certain library in Java, but don't want to "native" it.

My solution, at the time, was to rewrite it, in Java. Also, if you do a Google search for "java" + the library you might be able to find someone's unofficial package for that library. The two biggest problems with this would be (1) you hope the author documents everything properly - but this won't be much of an issue if you use an IDE like Netbeans or Eclipse - and (2) the method structures would be completely different - even moreso if written in C. I can't think of how many times I've tried to rewrite C/C++ libraries in Java, and just given up due to the convilution of some of them.
 
Old 01-15-2008, 11:50 AM   #8
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
It's not possible to rewrite some libs into "native" java (most of them deals with hardware).
 
Old 01-15-2008, 12:37 PM   #9
indienick
Senior Member
 
Registered: Dec 2005
Location: London, ON, Canada
Distribution: Arch, Ubuntu, Slackware, OpenBSD, FreeBSD
Posts: 1,853

Rep: Reputation: 65
Quote:
Originally Posted by Alien Homonid
It's not possible to rewrite some libs into "native" java (most of them deals with hardware).
Oh, I know - I should have been a little more specific with my comment - I was referring to things like graphics libraries, and some compression libraries.
 
  


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 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
LXer: Java news met with cautious optimism in free Java community LXer Syndicated Linux News 0 11-14-2006 10:21 PM
Firefox refuses to load Java jnlp files - plugin and java ok Melsync Linux - Software 1 06-25-2006 04:09 PM
Synaptic Package Manager shows 'java-common' and 'java-gcj-compat' as Installed. swiadek Ubuntu 3 02-12-2006 11:54 AM

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

All times are GMT -5. The time now is 03:52 PM.

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