Re: Java programs run in Netbeans but not outside

2020-08-16 Thread Mark Eggers
I do something similar and then package up everything as a zip file or
tar.gz with the assembly plugin.

Something like this:



org.apache.maven.plugins
maven-assembly-plugin
2.6

src/main/assembly/assembly.xml



And the assembly.xml file (leaving out the schema for brevity):


bin

tar.gz
zip

false
false


target


*.jar
lib/





Then, mvn package followed by mvn assembly:single gives me a tar.gz and
a zip file containing the correct structure. I can ship that around,
unpack it, and run the program from the command line with:

java -jar ./jarname.jar

Works for me.

. . . just my two cents
/mde/

On 8/15/2020 9:07 PM, Bradley Willcott wrote:
> Hi Bayless,
> 
> Are you using an Ant build or Maven?  If Maven, have a look at
> "maven-jar-plugin" and "maven-dependency-plugin".  Here is an example of
> both from one of my projects:
> 
>     
>     
>     
> org.apache.maven.plugins
> maven-jar-plugin
>     3.2.0
>     
>     
>     
> true
> libs/ <<===  Important
> org.markdownj.cli.Main
> true
> true
>     
>     
>     
>     
>     
> org.apache.maven.plugins
> maven-dependency-plugin
>     3.1.1
>     
>     
>     copy-dependencies
>     prepare-package
>     
> copy-dependencies
>     
>     
> runtime
> test
>     
>     ${project.build.directory}/libs    
> <<===  Important
>     
>     
>     
>     
>     
>     
>     
> 
> Of course, the "<<===  Important" text is not part of the POM text.
> 
> All you need to do then is copy the 'libs' directory to the same
> directory you install the 'jar' file to, and then it should work a
> charm.  Does for me.
> 
> Brad.
> 
> On 15/8/20 8:13 pm, Bayless Kirtley wrote:
>> I recently upgraded from Netbeans 8.1 to 11.1  and due to problems
>> with java 8 I also went to 11. I have been working on some existing
>> projects and everything works fine from within Netbeans. When I try to
>> deploy though, it seems that Netbeans is no longer including the lib
>> directory in the dist directory and the programs will not run. Even
>> when I just replace the jar file in the dist directory, leaving the
>> lib directory as it was, the programs still will not run. What do I
>> need to do to correct this situation?
>>
>> Bayless
>>
>>
>>
> 

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

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



Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.apache.openejb.client.RemoteInitialContexFactory

2020-08-16 Thread Anwar AliKhan
Hi,

When I run the java program like this it works fine.
java -cp
$OPENEJB_HOME/lib/openejb-client-3.1.4.jar:$OPENEJB_HOME/lib/jakarta.ejb-api-3.2.4.jar:.
org.acme.HelloClient
Hello World

But When I try to run same in Netbeans I get this error. (see bottom of
email)
Even though I do not have compile error and the classes are loaded  via
maven dependencies.

import java.util.Properties;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.rmi.PortableRemoteObject;
import org.acme.Hello;
import org.apache.openejb.client.RemoteInitialContextFactory;;  *// UNUSED
IMPORT WARNING*

public class HelloClient {

public static void main(String[] args) throws Exception
{
Properties props = new Properties();

props.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.openejb.client.RemoteInitialContexFactory");
props.put(Context.PROVIDER_URL,"ejbd://127.0.0.1:4201");
Context ctx = new InitialContext(props);
Object ref = ctx.lookup("HelloBeanRemote");
Hello h = (Hello)PortableRemoteObject.narrow(ref,Hello.class);
String result = h.sayHello();
System.out.println(result);
}
}

--- exec-maven-plugin:1.5.0:exec (default-cli) @ EJBHello ---
Exception in thread "main" javax.naming.NoInitialContextException: Cannot
instantiate class: org.apache.openejb.client.RemoteInitialContexFactory
[Root exception is java.lang.ClassNotFoundException:
org.apache.openejb.client.RemoteInitialContexFactory]
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
at javax.naming.InitialContext.init(InitialContext.java:244)
at javax.naming.InitialContext.(InitialContext.java:216)
at com.mycompany.ejbhello.HelloClient.main(HelloClient.java:28)
Caused by: java.lang.ClassNotFoundException:
org.apache.openejb.client.RemoteInitialContexFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at
com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:91)
at
com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
... 4 more
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1
(Exit value: 1)
at
org.apache.commons.exec.DefaultExecutor.executeInternal(DefaultExecutor.java:404)


[platform] StatusBar and ShowOnlyEditor

2020-08-16 Thread Patrik Karlström
Activating ShowOnlyEditor in a platform application hides the status bar.

Is it possible to keep the status bar visible even when ShowOnlyEditor is
activated?

/Patrik