Rectangle 27 1

I assume, you are using the application plugin and that is why this configuration for the run task is enough. That is, most likely you should have something like this:

if (!project.hasProperty('mainClass')) {
    ext.mainClass = mainClassName
}

run {
    configureRun(it)
}

task(debug, dependsOn: 'classes', type: JavaExec) {
    configureRun(it)
    classpath = sourceSets.main.runtimeClasspath
}

void configureRun(def task) {
    main = mainClass
    task.systemProperty "java.library.path", "./lib/native/"
}
Execution failed for task ':debug'. > No main class specified

instead of main = mainClass, shouldn't it be task.main = mainClass? In a similar instance though, this still is not solving my issue. Curious if it solves yours.

java - How do you debug a Gradle project with native dependencies in N...

java netbeans gradle
Rectangle 27 0

You can also load the library from within the program using this line:

System.loadLibrary("jmtp")

Place the folder containing the file jtmp.dll directly under the Java project.

System.setProperty( "java.library.path", "libs" );

Where as "libs" is the folder that contained the dll and is placed directly under the java project folder.

I noticed that the jmtp.dll gives the following exception with 64-bit JDK:

Exception in thread "main" java.lang.UnsatisfiedLinkError: libs/jmtp (.\libs/jmtp.dll is not a valid Win32 application. )
    at java.lang.ClassLoader.loadLibraryWithPath(ClassLoader.java:1018)
    at java.lang.ClassLoader.loadLibraryWithClassLoader(ClassLoader.java:982)
    at java.lang.System.loadLibrary(System.java:506)
    at podcasts.Transferer.main(Transferer.java:28)

java - Including Native Library in Netbeans - Stack Overflow

java netbeans-7 nativelibrary wpd
Rectangle 27 0

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());

The above will give windows look and feel, when it is inside WINDOWS. If in Linux, then the Linux look and feel. Best place to use this is inside your main method, something like following

*/
public class MyPhoneBookApp {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) 
    {
        try
        {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            new MainForm();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
    }
}

If you need a look and feel that doesn't change based on the OS, and something really nice, look at the following links which contains look and feel Jars

The problem was: at first I called the initComponents() method and after that the method given above, but now i called first the setLookAndFeel() and then initComponents().

@Dave: You are welcome Dave. If this answer solved your problem, then please mark this as the answer, so your question will go to the list of solved questions :)

java - Native OS look and feel Netbeans doesnt works with UIManager.se...

java windows user-interface look-and-feel netbeans-7.1
Rectangle 27 0

AWT
Swing

- If you code your GUI in AWT, with no extra effort , your code will have native look and feel.

setNativeLookAndFeel

java - Native OS look and feel Netbeans doesnt works with UIManager.se...

java windows user-interface look-and-feel netbeans-7.1
Rectangle 27 0

I just had a similar issue with a native-packaged JavaFX application where I was getting the "Failed due to exception from main class" error. My package.cfg looked the same as yours.

What I did to diagnose it was just to manually run the jar file (e.g. Project.jar) from the command line and see what the stacktrace was, e.g. if your Main class was in org.project.Project

java -cp Project.jar org.project.Project

Turns out for me that the URLs I had been using to load various files (e.g. the FXML files for JavaFX) packaged in the jar were causing issues - I was using relative URLs (e.g. "./blah.ext" or "../foo.txt" etc), but once I had changed the URLs to be absolute based on how the files were laid out in the jar it worked fine (e.g. "/org/project/blah.ext" and "/org/foo.txt").

netbeans - Java: how to create a working .exe from a native installer?...

java netbeans installer exe
Rectangle 27 0

[project] - right click - Properties - Libraries - Compile - Add JAR/Folder - [yourjar.jar] (+ "Absolute Path" on the right side of the dialog)

It's not a jar I'm trying to add, it's a Native Library - a DLL.

No. It definitely wouldn't work under "Compile" because java.library.path is used at runtime. However, I tried putting it there (for giggles) and in "Run" and it still didn't work. My guess is that it's because these lists are merely adding jar files and folders to you classpath, not to java.library.path. One is for java libraries, one is for native libraries.

java - Is there a netbeans equivalent to "Native library location" in ...

java netbeans configuration buildpath java.library.path
Rectangle 27 0

Looks like you're adding an action instead of configuring the the task, all your configuration on the task happens too late, that is at the execution time.

Either that or make sure your main (you must have one somewhere, right? I'm new to this) looks like:

java - How do you debug a Gradle project with native dependencies in N...

java netbeans gradle
Rectangle 27 0

You can use File > New Project > NetBeans Modules > Library Wrapper Module to make a library wrapper.

You have to create a Module Suite prior to the creation of the library wrapper. The suite acts as a container for the library wrapper. Create the module suite via File > New Project > NetBeans Modules > Module Suite.

The benefit of wrapping an external library by this mechanism is to reference that library as a regular module in your netbeans module suite.

I do not think DJ Native Swing cannot be linked as a regular library, but there may be (I do not say there have to be) some subtle modfications necessary to the steps described in the tutorial.

I still could not get it, i tried to File > New Project > NetBeans Modules > Library Wrapper Module :: When i browse to DJ native jar file and select it it goes to next process but ask for a regular suite. It does not go any further as it could not find a regular suite

Ok now I see. It seems you have to create a Module Suite prior to the creation of the library wrapper. Create it via File > New Project > NetBeans Modules > Module Suite.

now you add the libary wrapper and continue with the tutorial.

java - DJ native Swing and Netbeans - Stack Overflow

java netbeans-7
Rectangle 27 0

I also traced output by redirecting printlns, and it blew up the first time it called for an external library. I thought maybe I had the same problem as matt1 so I fixed all the relative paths, but no joy. I finally figured out that the installer was not creating the /app/lib folder with the external jar files. After manually copying the lib folder to the target installation folder it worked fine, even on a machine with no JRE installed (I'm working on a self-contained app).

The fix was to add a line to the build.xml:

<target name="-post-jfx-deploy">
   <fx:deploy width="${javafx.run.width}" height="${javafx.run.height}" 
             nativeBundles="all"
             outdir="${basedir}/${dist.dir}" outfile="${application.title}">
      <fx:application name="${application.title}" mainClass="${javafx.main.class}"/>
      <fx:resources>
          <fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
          <!--below is the magic bit that copies all the dependency jar files to the native package output-->
          <fx:fileset dir="${basedir}/${dist.dir}" includes="lib/*.jar"/>
      </fx:resources>
      <fx:info title="MyApp" vendor="MyVendor"/>
  </fx:deploy>          
</target>

The second fileset directive forces a copy of the jar dependencies from the lib folder, which fixed everything when deploying either as an EXE or an MSI.

netbeans - Java: how to create a working .exe from a native installer?...

java netbeans installer exe
Rectangle 27 0

I am on mobile. Will do it when I get home or feel free to post your own answer.

It's not so much using the JNI that I'm thinking about, but more the workflow of including the JAR,JNILIB(s) couple into your project workflow for efficiency, but thanks for the quick response!

I am not sure about NetBeans, but in Eclipse it is possible to seamlessly integrate everything.

netbeans - Java working environment when having to use native code - S...

java netbeans jvm native environment
Rectangle 27 0

I thinks your main class is not correctly set to package. Instead of using Netbeans you can make exe from your jar file using exe4J.(please make sure main class is set from project > properties > run > main class

netbeans - Java: how to create a working .exe from a native installer?...

java netbeans installer exe
Rectangle 27 0

Finally i found the solution, In order to include native library we need to add following steps in netbeans

This has worked for me to run the project in Netbeans, but once the jar is built the same error is back. So it's not helping in the long run.

Works for me, don't include the dll in the path, only the directory where it resides.

java - Including Native Library in Netbeans - Stack Overflow

java netbeans-7 nativelibrary wpd
Rectangle 27 0

The wrapper also provides better user experience through an application icon, a native pre-JRE splash screen, and a Java download page in case the appropriate JRE cannot be found.

@marcomauro I have never tried but the program says you can. "Launch4j wraps jars in Windows native executables and allows to run them like a regular Windows program. It's possible to wrap applications on Windows, Linux and Mac OS X!"

I am still wondering how to wrap jar by using NetBeans features. Why do I need a third party applications such as Launch4j ?

Java native packaging in NetBeans: How can I set the splash screen and...

java netbeans icons native splash-screen
Rectangle 27 0

JConsole can help viewing Java memory usage.

If you are using an existing Java-OpenGL library, it is possible it is using direct buffers which might not be getting freed. If you have written the native code yourself this probably wont apply.

For native memory, if your Java-OpenGL library is using direct buffers, I've noticed in JDK 7 only (I'm running the prerelease) that there are some extra MBeans visible in JConsole that are not there in previous versions that may help. Take a look in the MBeans tab in JConsole under java.nio.BufferPool. Under the 'direct' bean you can see the memory used up by direct buffers. If this keeps going up, it might indicate a direct memory leak (possibly because of not closing/disposing OpenGL resources in your Java code).

netbeans - How to find native memory leaks caused by a java code? - St...

java netbeans memory-leaks
Rectangle 27 0

When you start a process (for example on the command prompt, but it's the same AFAIK when you start another process from code) a certain group of paths (contained in the PATH (?) environment variable) is searched for an executable with a name matching what you entered. If the 64-bit and 32-bit version have the same name and the 64-bit version is found first, that one will be executed. I recommend specifying the full path of the 32-bit JDK.

EDIT: I just saw the question is about the NetBeans IDE. I've never used that, so the only advice I can give you is to look in NetBeans' settings, and adjust the path to the JDK and JRE, making it point to the 32-bit version. I'll leave my answer here for people not using NetBeans.

netbeans - Native Libraries, Error: This Java instance does not suppor...

java netbeans jvm nativelibrary