Showing posts with label jar. Show all posts
Showing posts with label jar. Show all posts

Thursday, April 5, 2018

NetBeans: one or more project resources could not be found

When you open an existing java project from NetBeans, you get the following message.


[Thumbnail for referenceRUSAK.jpg]



To fix this, click the Close button to close the message. Right-click on the project and select Properties.


In the popped-up Project Properties window, select the Libraries under the Categories, and you will see a list of broken references on the Compile tab.



Select these broken references and click the Remove button to remove them.

Click the Add JAR/Folder button to add the jars needed or refer to this article to create and add the libraries you need for your project.

-----------------------------------------------------------------------------------------------------------------
Watch the blessing and loving online channel: SupremeMasterTV live




If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book for free here.


Thursday, January 21, 2016

Error: Could not find or load main class in Java

Following are some of the major causes of this error.

1. Misspell the class name. For example you want to execute command "java HelloWorld", but did "java HaloWorld".

2. Use <class name>.class or <class name>.java. For example use command "java HelloWorld.class" or "java HelloWorld.java" instead of "java HelloWorld".

3. The class path is not set for the class you execute. You may fix this by doing one of the followings.           A. Add class path to the CLASSPATH environment  variable and make sure it is correct.

          B. Use the -cp or -classpath option when execute the class.
                 For example, java -cp C:\Test MyTest

4. The jars required for executing your class are not set in your CLASSPTH,

5. When the class is in a package, it is not executed in the right directory or with the correct complete name.
          For example, the CareMaster class is created in the com.care.gui package.

          A. You must execute it using its complete name,

                java com.care.gui.CareMaster

                if you use "java CareMaster", it will cause the "Could not find or load main class CareMaster" error.

         B. You must execute the class in the directory containing the com directory.
     
6. Execute a jar that does not have a Manifest.mf file or the Main-Class and/or the Class-Path in the manifest.mf are not correctly set.

If none of the above works, try to close all your IDEs and applications, wait for a few minutes and retry. Or turn off your computer, let it rest for a few minutes.

---------------------------------------------------------------------------------------------------

                        


If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

References

1. Run .jar file in Windows
2. How to add jars to the class path of your main application when you are doing a distribution/software release



Tuesday, January 13, 2015

The action can't be completed because the file is open in java(tm) platform se binary - not able to delete a file

This usually happens when after you stop running a program, you open the directory on your hard drive to delete the jar file. Even though the program stopped running, the jar file is still open in Java virtual machine.

IDE
If you are running the program in a Java development IDE, check the Output pane to make sure that all related executions are terminated and removed. If this does not solve the problem, close and reopen the IDE shall get it resolved.

Windows
If you are using Windows, you can open the Task Manager by press the three key Ctl+Alt+Delete at the same time. Look at the Applications tab and the Processes tab to end all the java processes.

You can also open the command line and type 'tasklist | grep java' to get all the running java programs. Terminate all the related java programs by command 'taskkill /F /PID pid'.

UNIX/Linux
If you are running on a UNIX/Linux terminal, use 'ps -ef' to get all the processes, and then use 'kill -9 pid' to kill all the programs that use the file you are trying to delete from the folder.

If none of the above works, log out and re-log in your computer will be sufficient to solve the problem. It should not go that far that requires you to reboot your computer, even though that will definitely fix the problem.
       
-----------------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

Tuesday, August 26, 2014

Run .jar file in Windows

1. Specify the Application entry point
      Method 1
            A. Create the manifest.mf file with the following content. This file must ends with an empty line after the last line, otherwise, it will not be processed properly.


           Main-Class: <package>.<file>.class

            B. Create the jar file and specify the application entry point by executing one of the following commands.

                      jar -cfm <file>.jar manifest.mf  <package>/*.class

      Method 2
            Set the entry point to <package>.<file>.class by running the following command.

                   jar -cfe <file>.jar <package>.<file> <package>/<file>.class

2. Put all the jar files and other required files such as properties files if they are not included in the jar already in the same directory.

   To run from the command line, type: java -jar <file>.jar


  To run by double click the jar file, the .jar file type has to be associated with the java execution program. To set the association, do the following.

     A. Open the Control Panel
     B. Go to Programs\Default Programs
     C. Click Associate a file type or protocol with a program
     D. Scroll down the list, double click on the .jar entry
     E. Click the Browse and choose C:\Program Files\Java\jre7\bin\javaw or wherever your java is installed
     F. Click Open and then OK

3. Follow the steps here to create a desktop icon to launch the application by double clicking on the icon.
          A. Right click on desktop, choose New, then Shortcut.
          B. Enter java -jar <file>.jar in the text box, and click Next
          C. Enter a <name> for your shortcut, then click Finish
          D. Right click on the <name> shortcut on your desktop and choose Properties
          E. In the Start in: box, enter the path of the directory where the <file>.jar is located. click Apply.
          F. Click the Change Icon button and browse to select an image to use for your shortcut. Click OK and OK.

---------------------------------------------------------------------------------------------------------------

                        

If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

Wednesday, August 20, 2014

How to add jars to the class path of your main application when you are doing a distribution/software release

The main application contains the main method that serves as the entry point for running your application. In the top directory of your main application, there is a file named manifest.mf. The file looks like the following.

          Manifest-Version: 1.0
          Class-Path:  . ojdbc14.jar
          Created-By: NetBeans IDE
          Main-Class: com.goodfeeling.Application

List all the jars required by your application in the Class-Path entry in the manifest.mf file. The jar file names are separated by a space, which would look like this.
 
         Class-Path:  . ojdbc14.jar  commons-logging.jar log/log4j.jar your-application-helper.jar

The path entered here corresponding to the location of the jar file relative to your main application. For example if your main application is at C:/Application/MainApplication.jar, the ojdbc14.jar would be located at C:/Application/ojdbc14.jar, and the log4j.jar would be located at C:/Application/log/log4j.jar.

Save this manifest.mf file and make a jar for your main application which would have this file included in the jar file. Distribute the jar together with all the other jars required for running your application and listed in the above Class-Path to the users.

--------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.

Monday, January 6, 2014

Run .jar file of a SWing GUI application on a different computer through PuTTY


  1. Check if Xming Server is running on your computer by either looking at the task bar or by checking Xming.exe on the Processes tab of the Windows Task Manager. To open the Windows Task Manager, press Ctrl+Alt+Delete.
  2. Open PuTTY, choose Connection, SSH, then X11.
  3. Check Enable X11 Forwarding. In the X display location, enter localhost:0. For Remote X11 authentication protocol, select MIT-Magic_Cookie-1.
  4. Click on Session, enter the IP address of the remote computer in the Host Name box. If you would like to save your session setting, enter a session name in the Saved Sessions box and click the Save button. 
  5. Click the Open button to start the connection. After logged onto the remote computer, you can check the display setting by typing "echo $DISPLAY". 
  6. Type "jar -jar <file>.jar" to start your application.
---------------------------------------------------------------------------------------------------------------

                        
If you have ever asked yourself these questions, this is the book for you. What is the meaning of life? Why do people suffer? What is in control of my life? Why is life the way it is? How can I stop suffering and be happy? How can I have a successful life? How can I have a life I like to have? How can I be the person I like to be? How can I be wiser and smarter? How can I have good and harmonious relations with others? Why do people meditate to achieve enlightenment? What is the true meaning of spiritual practice? Why all beings are one? Read the book free here.