Runtime Error - Could Not Find Or Load Main File Java

Aug 2, 2014

i have a run time error that could not find or load the main file java .

View Replies


ADVERTISEMENT

Could Not Find Or Load Main Class Error

Sep 13, 2014

I have a problem that happens randomly where i try to compile and it just comes up with error

"Error: Could not find or load main class com.productiontrackingscreens.rexam.EmployeeAddressList"

This is a program that worked fine until i started it today. Seems a bug with eclipse.

View Replies View Related

Error - Could Not Find Or Load Main Class

Sep 30, 2014

I'm trying to run a java program from cmd. I'm using Windows 8, java version "1.8_0_20". I've got two classes, the main class called Middleware and a secondary class, called WorkerThread, of which the main class is using functions. I've successfully compiled both .java files with javac, and created the .class file. So all files are in the same folder. However, when I attempt to run the main class with java Middleware, I get the error message: "Error: Could not find or load main class". Here's the main class:

package middleware;
import java.net.*;
import java.util.concurrent.*;
public class Middleware {
//Number of threads serving clients.
private static int nr_threads = 5;
private static int portNr = 6789;
private static ServerSocket welcomeSocket;
private static ExecutorService executor;

[code]....

My code compiles and runs fine in eclipse but on the console, I'm having troubles.

View Replies View Related

Stuck On Error - Could Not Find Or Load Main Class

Sep 2, 2014

I'm getting an error trying to run a welcome app from a book. I've looked at the FAQs and can't seem to solve the issue. I'm guessing my path and/or classpath are not right. Here's my path environment variable.

C:jdk1.8.0_20in;C:ProgramDataOracleJavajavapath;C:Program Files (x86)NVIDIA CorporationPhysXCommon;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerSh

[Code] ....

Here's my output.

09/01/2014 10:23 PM 634 Welcome.class
09/01/2014 10:21 PM 422 Welcome.java
14 File(s) 126,243,703 bytes
9 Dir(s) 53,942,079,488 bytes free

[Code] .....

It looks like the version command gives me what it should, so it appears I've got java setup right, but I"m stuck on the error I'm getting :

C:jdk1.8.0_20>javac -version
javac 1.8.0_20
C:jdk1.8.0_20>

View Replies View Related

Error - Could Not Find Or Load Main Class GameTester

Oct 29, 2014

I was trying to write my own version of the game SimpleDotCom from Head First Java. I have two files:

Game.java:
package project_01;
public class Game{
byte hitCount = 0;
String result = "miss";
int counter = 0;
String checkGuess(int[] location,int userGuess){

[Code] .....

The two files are in the same directory, "project_01" and the CLASSPATH environment variable is set to ".;".
The game compiled but when I tried launching it with "java GameTester" it returned the error : Could not find or load main class GameTester. I know my game is horrible and probably extremely buggy but I'll fix all the bugs, etc. later, right now I just need to get it to run.

View Replies View Related

Error / Could Not Find Or Load Main Class HelloWorld

Jan 8, 2015

My problem is that I can compile a java HelloWorld program using javac HelloWorld.java but I cannot run the program using java HelloWorld. I didn't create the code it was developed by a professional programmer. My assignment is to compile and run, so that I see the output.

View Replies View Related

Using Java From DOS Command Line - Cannot Find Or Load Main Class

Nov 10, 2013

When I try to run Java from the Windows DOS command line, I'm running into trouble:
 
1. When I run Java from the wrong directory, I get the error Error: cannot find or load main class myapp1.
 
2. When I get to the "right" directory (.../MyApp1/build/classes/myapp1/, which is where the MyApp1.class file resides), I get the following error:
 
Exception in thread "main" java.lang.NoClassDefFoundError: MyApp1 (wrong name: myapp1/MyApp1)
 
1. The CLASSPATH variable is not set (when I type echo %CLASSPATH% the system returns %CLASSPATH%).

2. I also get the same error above when I use: > java -cp . myapp1

3. I've made sure the PATH is set correctly in environment variables, with the Java path at the beginning of the path string).

View Replies View Related

Error - Could Not Find Required Version Of Java(TM) 2 Runtime Environment In (null)

Jun 30, 2014

I have installed and tested j2se jdk8 u5 on my Windows 7 64 bit laptop and successfully tested in Eclipse with a quick Hello World.

JAVA_HOME = C:Program FilesJavajdk1.6.0_25

When I try to install j2ee jdk7 sdk7 I get

Error: Could not find the required version of the Java(TM) 2 Runtime Environment in '(null)'

View Replies View Related

JDK 1.6 - Could Not Find Or Load Main Class

Sep 23, 2014

I have permanently set the path of bin of JDK 1.6 in the environment variables of my system. I am able to compile any of my java programs successfully. But when I give command to run the program I am getting an error "could not find or load main class".

When I write the command "set classpath=.;" program runs successfully. I want to know whether I have to set this classpath everytime I run a new progaram. Is there any permanent way to set classpath ?

View Replies View Related

Could Not Find Or Load Main Class

Mar 1, 2015

I creates this simple code (shown below) inside a package of a major opensource code (i.e., openSHA), but when i run it the following error appears. The error mentions a class named "KT_testGmpeForScenarioRupture" that i wrote before and did not run showing exactly the same error.

Code:

package org.opensha.sha.gcim.imr.attenRelImpl;
public class KT_Test {
private static void main(String args) {
int x=4;
System.out.println("x is " + x);
}
}

Error: Could not find or load main class org.opensha.sha.gcim.imr.attenRelImpl.KT_testGmpeF orScenarioRupture

View Replies View Related

Cannot Find Or Load Main Class

Nov 19, 2014

I am using Netbeans as my IDE and I have created a program called Saluton.java

I navigate to the folder holding the class file using the command line under Windows 7 but when I issue the command java Saluton.class I get an error it cannot load or find the main class.

View Replies View Related

Could Not Find Or Load Main Class In CMD

Sep 23, 2014

I tried running my program on cmd but it produces the error "could not find or load main class" ...It compiles well but it just doesn't run. Here is my code:

package writedoc;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
public class WriteDoc {
public static void main(String[] args) throws IOException {
String strDocument="grades.txt";

[Code] ....

View Replies View Related

JavaDigest - Could Not Find Or Load Main Class

Nov 15, 2014

Could not find or load the main class.

package in.javadigest.encryption;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.security.KeyPair;

[Code] ....

Its compiling the compiled class is in C:programsclass folder. Iam running the program using the following commands...

javac MainClass2.java // This is working fine
java -cp C:programsclass MainClass2

View Replies View Related

JAR - Package Directory - Can't Find Or Load Main Method

Apr 24, 2015

I am trying to understand how package(directory structure) and JAR files work interchangeably. From my understanding JAR is a package file format typically used to aggregate many Java classes. Since many classes are usually contained inside a package, I should be able to create a JAR file from a package, and use them interchangeably. A single JAR file is easier to handle then multiple classes and folders.

To test my understanding of the concept, I am working with the following project structure,

/development_directory
____/BookPackage
________Book.java
____BookDemo.java

Book.java contains the following code,

package BookPackage;
public class Book{
private String bookname;
public Book(String str){
bookname = str;
}
public String getBookName(){
return bookname;
}
}

and BookDemo.java contains the following code,

import BookPackage.Book;
class BookDemo{
public static void main(String ... args){
Book b = new Book("Lord of the Rings");
System.out.println(b.getBookName());
}
}

From the development_directory, I used the following commands to compile and run the project,

development_directory/ javac BookDemo.java
development_directory/ java BookDemo

...and it compiles and works as expected.Now, I will try to convert the BookPackage folder(package) into single jar file for portability, and I am using the following command to do that,development_directory/ jar -cf bookpkg.jar BookPackage ...this command generates the bookpkg.jar file.

I am going to remove the BookPackage folder to see if bookpkg.jar file really works as a replacement for the BookPackage directory structure.

After removal of BookPackage folder, the development_directory structure looks like this,

/development_directory
____bookpkg.jar
____BookDemo.java

Now, I tried to use the following commands to see if the program works as before,

// to compile
development_directory/ javac -cp ./bookpkg.jar BookDemo.java

...it compiles without any error - this means the replacement of bookpkg.jar for BookPackage(package) folder structure is working - Am I correct?

// to run
development_directory/ java -cp ./bookpkg.jar BookDemo

...And I hit an error,

Error: Could not find or load main class BookDemo

But the BookDemo class is at default namespace - why it JRE won't be able to find the main method?

And, the way I am trying to replace package folder structure with a single JAR file - am I getting the concept correctly?

View Replies View Related

Could Not Find Or Load Main Class HelloWorld - Notepad++

Dec 11, 2014

I'm new to this java stuff and when I go to notepad++ and this keeps coming up when I try to compile it: "Error: Could not find or load main class HelloWorld" what it means...

View Replies View Related

Declaring Enums - Could Not Find Or Load Main Class

Feb 25, 2014

I've just started, so right now I'm reading about declaring enums, the book lists the following code

enum CoffeeSize {
//8,10 & 16 are passed to the constuctor
BIG(6), HUGE(10), OVERWHELMING(16);
CoffeeSize(int ounces){ //constructor
this.ounces = ounces;

[Code] .....

I'm assuming that code to be in a same file since enums can be declared within and outside a class, so I saved it into a file named "Coffee.java", it compiles just fine from command line but when I try to execute "java Coffee" it throws "Error: Could not find or load main class Coffee"...

View Replies View Related

Using Eclipse To Maintain Java Application - Could Not Find Main Class Error

Sep 3, 2014

I currently use Eclipse to maintain our Java application. I recently upgraded from Java 6 to Java 7. I updated my Eclipse projects to use the Java 7 .jar files. I can run the application from Eclipse via the Run Configuration.

I can also run the Ant build and it completes successfully. When I install the application on my desktop, I receive the "Java Virtual Machine Launcher: Could not find main class..." error. My CLASSPATH is set to ".".

View Replies View Related

Write A File To Disk And Then Load It - No Main Class Found?

Jun 19, 2014

Whenever I try to write a file to the disk and then load it within the same Class (if it is even possible) ...

It gives me an error: Could not find the main class: score.Score. Program will exit.

I have tried this with 2 different classes and it works fine? Why that error is appearing.

Code:

package score;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Scanner;
public class Score {
public static void main(String [] args) throws Exception

[Code] .....

View Replies View Related

Error Could Not Find Or Run Main Class

Jan 7, 2014

I made a breakout like game that runs as a applet and now i wanted to make it run in a jframe so i wrote this

Java Code:

import java.applet.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
public class BrickBuster{
public static void main(String[] args){
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
JApplet BrickBuster = new JApplet();
frame.add(BrickBuster);
BrickBuster.init();
}
} mh_sh_highlight_all('java');

It compiles fine but whenever i try running it with the java command it says it couldnt find or load main class. also i have it save in a folder called BrickBuster so i called java BrickBusterBrickBuster.class

View Replies View Related

Error In Main Method - Cannot Find Symbol

Dec 15, 2014

I am writing a palindrome program. I don't understand what is wrong with my Main method. It is giving me error and error is "Can not find symbol in main method"

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class PalindromeA extends JFrame {
private JTextField inText;
private JTextField outText;

[Code] ....

View Replies View Related

Runtime Error With DB Table Generator File

Oct 14, 2014

I am having some issues with this code its a a DB generator that creates tables and populates them. There seems to be no compiler errors, but there is a runtime error. I have added the error and the code below :

Runtime error:

Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC Driver Manager]
Data source name not found and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6964)

[Code] .....

My Code:

MakeDB.java
import java.sql.*;
import java.io.*;
public class MakeDB {
public static void main(String[]args) throws Exception {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

[Code] .....

View Replies View Related

Fatal Error Has Been Detected By Java Runtime Environment

Jul 8, 2014

While executing my application i came across with this unexpected error which i don't know why?

#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x000007fdcacd79a9, pid=4980, tid=7724
#
# JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# C [ntdll.dll+0x79a9]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit: [URL} .....
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

View Replies View Related

How To Load XML File Inside Of Java Class File In Netbeans Project

Feb 26, 2015

try {
File configFile= new File("C: Documents and SettingsstudentMy DocumentsNetBeansProjectsCDASsrcconfig.xml ");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
doc.getDocumentElement().normalize();
NodeList nList = doc.getElementsByTagName("config");

[Code] .....

This code is working properly but i have use path like this

File configFile= new File("srcconfig.xml");

Instead of system directory path i have to use path inside of project but i am getting an error-cannot find the specified file...

View Replies View Related

No Main Methods / Applets / Or MIDlets Found In File Error Message

Apr 17, 2015

I am assigned to create a program "Simpletron" that the only language understands it is Simpletron Machine Language or SML. I figured out the most but I get the message "No main methods, applets, or MIDlets found in file" when compiling the program. I pasted my program so that you can see.

//A Simpletron computer simulator */
import javax.swing.*;
import java.text.DecimalFormat;
import java.awt.*;
import java.awt.event.*;

[code]....

View Replies View Related

Java Runtime Get Result Output From Prompt / Large File - Process Will Hang

Aug 13, 2014

I am using java process to start a system command in windows

Runtime r = Runtime.getRuntime();
Process pr = r.exec(cmdString);

I want to get the prompt out put from cmdString = "cmd /c type fileSmallSize"->>>> It is ok the have the content of the file when file is small.

However, for a large file java process will hang and no Exception occurred, what is the problem?

The easiest testing you can try on the logging.properties file in java.

public static String executeCmdAndReturnPromptResult(String cmdString)
throws Exception {
LOGGER.entering(CLASSNAME,
"Entering executeCmdAndReturnPromptResult()", cmdString);
String cmd = cmdString;

[Code] ....

It seemed to me that the bufferSize is limited so that I can only have it less than a default one, how to increase it?

My question now is how to increase the size of buffer in order to read a larger InputStream ?
BufferedInputStream() default size is
private static int defaultCharBufferSize = 8192;
private static int defaultExpectedLineLength = 80;

How to make it larger and working? I tried to increase the defaultCharBufferSize to 500000000 but it did not work!

View Replies View Related

How To Load Java File Into Netbeans So Can Work With It

May 12, 2015

I have a couple .java examples I want to mess with but don't know how to get them into Netbeans so I can work with them. What is the process in loading a .java into Netbeans so I can work with the code and run it in Netbeans?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved