Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9228157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T05:15:16+00:00 2026-06-18T05:15:16+00:00

I use netbeans to create my java projects for school. I don’t like how

  • 0

I use netbeans to create my java projects for school. I don’t like how netbeans uses an internal console instead of the usual black CMD/Windows/Terminal console so I decided to compile my project via Command-Line using a batch file. My batch file refuses to run the jar though. It says that main class is not found. I cannot figure out why :S

Can someone help me or tell me how to fix it?

All the information needed to help me I believe is below:

@echo off

set ProjectName=WildWidgetsWarehouse.jar
set ProjectPath=C:/Users/Brandon/Documents/NetBeansProjects/

set path=C:/Program Files/Java/jdk1.7.0_11/bin


cd /d %~dp0
ECHO.
dir %ProjectPath%/*.java
ECHO.
ECHO.

for %%* in (.) do set FolderName=%%~n*
for %%* in (..) do set ParentDirectory=%%~dpnx*

javac -d ../Classes *.java -cp ../Classes;std.jar

cd %ParentDirectory%\Classes
jar cvf %UserProfile%\Desktop\%ProjectName% %FolderName% .*
java -cp . %UserProfile%\Desktop\%ProjectName%

PAUSE

When ran, it prints:

Invalid switch - "Users".

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
.* : no such file or directory

Prints all the file it added.. It adds all my classes.. See picture below

Error: Could not find or load main class C:\Users\Brandon\Desktop\WildWidgetsWar
ehouse.jar
Press any key to continue . . .

My Jar file looks like:

enter image description here
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T05:15:17+00:00Added an answer on June 18, 2026 at 5:15 am

    to run a jar file, you need -jar option

    java -jar xxx.jar
    

    please man java, read -jar option part.

    also you may want to add main-class information into the manifest of your jar file.

    man jar, and check out the e option.

    the MANIFEST.MF of your jar should look like (just example)

    Manifest-Version: 1.0
    Created-By: 1.6.0 (or maven, ant, blahblah)
    Main-Class: com.yourpackage.MainClass
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Netbeans IDE. My hibernate.cfg.xml looks like this: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE hibernate-configuration
i use netbeans to check out projects from svn repo, then i edit the
Much like Java (or php), I'm use to seperating the classes to files. Is
I would like to create Java applications, but my first brake is that it
In doing JAVA based web projects using JSP in netbeans, under Web Pages folder
I'm using Netbeans 7.1 to develop a number of Java projects. Several of the
In the NetBeans 6.9 IDE, if you create a New Project >> Java >>
I make use of: NetBeans IDE 6.7.1, GlassFish v2.1, Oracle 10g XE, JAVA 6
first i'd like to point out that im fairly new to netbeans and java,
I am trying to create a DLL to use it with Java JNI. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.