You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Amn Ojee Uw <am...@gmail.com> on 2022/03/04 16:15:50 UTC

NB & Eclipse about jar files

I have recently have done a major shift as a developer, I switch from MS 
to Debian 11 and as they say "New year, new life". So, I've also changed 
my developing platform to NetBeans 12.x from Eclipse. I have realized 
that the jar files produced by Eclipse are not desirable by  NB 12.x.
Is this the norm? Should I always assume that  Eclipse produced jar 
files will not run on NetBeans?

As a personal note, let me say that this issue must not exist; "Write 
once, run anywhere"?

Perhaps, someone here could point out a document on the net that 
addresses this issue.


Thanks in advance.

Re: NB & Eclipse about jar files

Posted by antonio <an...@vieiro.net>.
jar files are just zip files with another extension. You can see their 
contents using any tool that is able to open zip files.

NetBeans has no problems opening any jar file, be it produced by Eclipse 
or whatever.

Cheers,
Antonio

El 4/3/22 a las 17:15, Amn Ojee Uw escribió:
> changed my developing platform to NetBeans 12.x from Eclipse. I have 
> realized that the jar files produced by Eclipse are not desirable by  NB 
> 12.x.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: NB & Eclipse about jar files

Posted by Eric Bresie <eb...@gmail.com>.
What are you trying to accomplish? Run (within the IDE or external to the
IDE), decompile or peak into, or add as a dependency?

There is always the basics:
https://docs.oracle.com/javase/tutorial/deployment/jar/basicsindex.html

Jars package compiled java code for use in valid installed java runtime
platforms (Windows, Linux, MacOS).

When running jars, the normal expectations are to
(1) Java Runtime Environment (JRE) at a minimum although a Java Development
Kit (JDK) is also possible.  Do you have a compatible JRE or JDK
installed?  Assume you do, if able to run Netbeans
(2) Classpath is defined to help locate the jar.  This can be done by
setting a Classpath environment variable (either global, user, or via
"batch" or "shell script") or passed on command line with an applicable
parameter (i.e. -cp).  Without this, it may not be able to "find the jar"
to work with.  Classpath settings may also be different depending on where
and when your running things.
(3) In Windows it may be configured to right click and run as Java type
usage.  Something similar on Linux maybe possible.  Otherwise,  that usage
of basic shell/command prompt based execution is normally in a java -jar
<name of jar> with maybe a -cp and maybe calling out the "main class" to be
used to execute

If you are talking about something else in Netbeans like
(1) Expanding the compressed zip to see inside,  Should be able to do so
within the Project view and drill down where applicable.
(2) Run it from the IDE, the IDE normally runs things based on code
associated with a "main java source" and applicable source based.  In some
cases (i.e. like maven project) it is possible to use the "build tool" to
tell it to run.
(3) Dependencies within the IDE: This depends on the type of project (i.e.
ant, maven, Eclipse project, Netbeans Project, etc.) which each have there
own way of handling dependencies.

Hope some of this helps.

Eric Bresie
ebresie@gmail.com


On Fri, Mar 4, 2022 at 10:16 AM Amn Ojee Uw <am...@gmail.com> wrote:

> I have recently have done a major shift as a developer, I switch from MS
> to Debian 11 and as they say "New year, new life". So, I've also changed my
> developing platform to NetBeans 12.x from Eclipse. I have realized that the
> jar files produced by Eclipse are not desirable by  NB 12.x.
> Is this the norm? Should I always assume that  Eclipse produced jar files
> will not run on NetBeans?
>
> As a personal note, let me say that this issue must not exist; "Write
> once, run anywhere"?
>
> Perhaps, someone here could point out a document on the net that addresses
> this issue.
>
>
> Thanks in advance.
>

Re: NB & Eclipse about jar files

Posted by Chuck Davis <cj...@gmail.com>.
It's hard to know what you are wanting to do with little to no information.

In all probability the jar files produced via Eclipse are osgi bundles
(extra metadata in the manifest).  So you will have to run them on either
Felix or Equinox (or another osgi implementation) in a NB environment.

It would probably be best to move your source code to NB rather than jar
files if you are changing your environment as you say.  NB handles osgi
bundles fine but you have to set up the osgi environment in NB which, in
Eclipse, is probably your default.  Personally, I use NB to create the osgi
bundles and run them externally in Felix rather than muck around attempting
to run them within NB.  It's trivial to set up the external environment and
you don't get into the issues some people have of things running in NB but
then they don't run when they try to deploy.

Apache Felix is only a download away (you'll also probably want the bundle
repository) and has fair documentation.  Eclipse comes with the osgi
Equinox environment as default. If you're new to osgi there is a learning
curve.  If you move your source to NB and don't need the osgi runtime you
can recompile to regular jar files and run in NB without setting up the
osgi environment.  Choices, choices...........



On Fri, Mar 4, 2022 at 8:16 AM Amn Ojee Uw <am...@gmail.com> wrote:

> I have recently have done a major shift as a developer, I switch from MS
> to Debian 11 and as they say "New year, new life". So, I've also changed my
> developing platform to NetBeans 12.x from Eclipse. I have realized that the
> jar files produced by Eclipse are not desirable by  NB 12.x.
> Is this the norm? Should I always assume that  Eclipse produced jar files
> will not run on NetBeans?
>
> As a personal note, let me say that this issue must not exist; "Write
> once, run anywhere"?
>
> Perhaps, someone here could point out a document on the net that addresses
> this issue.
>
>
> Thanks in advance.
>