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
ADVERTISEMENT
Nov 29, 2013
I am trying to make a Applet and it works fine in Eclipse, but when I use it on the webserver I only obtain this Exception. It only happen when I make calls like this:
if(JSTUTablet.isConnected())
{
try {
JSTUTablet.setInkingMode(true);
JSTUTablet.StartCapture();
puntos = JSTUTablet.getPenPoints();
JSTUTablet.clearScreen();
JSTUTablet.setImage("foto.png");
} catch (InvalidOperationException e) {
e.printStackTrace();
}
}
Being JSTUTablet an imported jar file.
View Replies
View Related
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
Apr 25, 2014
I am working on a magic square program. My program compiles. However, when I enter the square dimension it does not select the correct file. The error says "java.io.FileNotFoundException." It looks like it inserts 0 instead of the entered dimension.
import java.util.*;
import java.io.*;
public class Trial2
{
public static int size, row, col;
public static void main(String[]args)throws java.io.IOException
[Code] ....
View Replies
View Related
Dec 6, 2014
Spoiler
import java.applet.*;
import java.awt.*;
public class JhonnyBravo extends Applet {
/**
*
* @param g
*/
@Override
public void paint(Graphics g) {
Color skin = new Color(241, 210, 169);
[Code] .....
View Replies
View Related
Aug 2, 2014
i have a run time error that could not find or load the main file java .
View Replies
View Related
Aug 17, 2014
class DrumKit {
boolean topHat = true;
boolean snare = true;
void playTopHat() {
System.out.println("ding ding da-ding");
[Code] ....
View Replies
View Related
Jun 29, 2014
public class Regextest {
public static void main(String a[]){
String stream = "ab34ef";
Pattern pattern = Pattern.compile("d*")
[code]....
My question is: The methods start()will give the indexes into the text where the found match starts .d*, this means if a number found.index must be returned. Why doesn't it print 3? 12345
Another question: Why it prints 6?
0>a
.
.
.
5>f
What is this 6 in out put?
View Replies
View Related
Jan 25, 2014
The code below keeps giving me errors at runtime.
import java.util.*;
import javax.mail.*;
public class SendSmtp
{
public static void main(String [] args)
{
Properties properties = new Properties();
properties.setProperty("mail.smtp.host", "localhost");
Session mailSession = Session.getDefaultInstance(properties, null);
}
}
My intention is to send email locally on a Dovecot SMTP server using Postfix. I compile it with the command:
javac SendSmtp.java -cp /usr/share/java/geronimo-javamail-1.4-spec.jar
and run it with the command:
java SendSmtp
but I keep getting the error message:
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Session
at SendEmail3.main(SendEmail3.java:15)
Caused by: java.lang.ClassNotFoundException: javax.mail.Session
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 1 more
View Replies
View Related
Feb 20, 2014
I am trying to use hidden variable in project.When I launch my project i am able to get the welcome page.But when submit login values i am getting HTTP 404 error- Resource not found error.
`My home Page/Login Page
<body>
<form action="<%=request.getContextPath() %>/LoginServlet" method="get">
USERNAME<input type="text" name="uname"><br>
PASSWORD<input type="password" name="pass"><br>
<input type="submit" name="submit" value="submit">
My LoginServlet
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("sandeep");
PrintWriter out=response.getWriter();
String userName=request.getParameter("uname");
[code].....
View Replies
View Related
Feb 21, 2015
getting the value of the selected radio button. My jsp file has the below code:
<h:selectOneRadio label="Requests" value="#{user.a_request}" layout="pageDirection">
<td ><f:selectItem itemLabel="Forward Request to A" itemValue="A"/></td>
<td ><f:selectItem itemLabel="Forward Request to B" itemValue="B"/></td>
</h:selectOneRadio>
Any my java bean has:
package test;
import java.io.Serializable;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import java.util.Map;
[code]...
in the value of the radio button "{#user.a_request}", it is producing an error that the reference "user" is not found.
View Replies
View Related
Apr 24, 2014
So I built this comparator exactly the same way I built my others that are working.But the comparator for UserComparator is not being found for some reason.I will post my usercomparator class and JSP page.
<%@page import="tickets.UserComparator"%>
<%@page import="tickets.User"%>
<%@page import="tickets.ReporterTTComparator"%>
<%@page import="tickets.StatusTTComparator"%>
<%@page import="tickets.SystemTTComparator"%>
<%@page import="java.util.Collections"%>
<%@page import="java.util.ArrayList"%>
<%@page import="tickets.TroubleTicket"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
[code]....
View Replies
View Related
Apr 7, 2015
I am trying to create a Hangman program using Arrays. When trying to compile my code I get the following error: 50: error: no suitable method found
for setCharAt(int,String)
method StringBuffer.setCharAt(int,char) is not applicable
method AbstractStringBuilder.setCharAt(int,char) is not applicable
Here's the code:
import java.util.*;
import java.io.*;
public class hangman {
public static void main() throws IOException {
Scanner kb = new Scanner(System.in);
String filename;
[code]....
View Replies
View Related
Jan 9, 2014
I have written a sample java program, in which I have imported a package com.ibm.mq.
While compilation in as400 machine,I am getting an error like package com.ibm.mq not found.
I have set classpath and also run a hello world program.
View Replies
View Related
Mar 11, 2014
I'm very new to java code I'm currently learning about loops I've tried to write this for a statement in the program I'm making but its not working. I keep getting this message
LoanQualifier.java:26: error: illegal start of expression
if (salary >0||<=250000)
^
LoanQualifier.java:28: error: illegal start of type
if (yearsOnJob >0||<50)
I'm using Jgrasp for a complier
View Replies
View Related
Jan 6, 2015
I have a servlet that adds entries to a table and when there is a duplicate it redirects to an error page and I'd like to make it display the duplicate entry id.The problem is when I try to get the parameter and show the error (the duplicate entry id) on my jsp error page it shows null instead of the appropriate number.this is my servlet:
package package_ergasia;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
[code]....
View Replies
View Related
Sep 1, 2014
I wrote this program to prompt user to enter his choice to do a i/o operation in a file. It shows error. How to clear the error. My code is:
import java.io.*;
import java.util.*;
class Files {
public static void main(String args[]) {
String n;
[Code] ....
error:
E:java>javac Files.java
Files.java:26: error: no suitable method found for write(String)
fos.write(n);
[Code] ....
View Replies
View Related
Apr 14, 2015
I am trying to print out all of the values of an array and the average. I am getting part of the printout but I am also getting an array out of bound error message. what I am doing wrong?
int [][] points = new int [2] [3];
points [0][0]= 3;
points [0][1]= 2;
points [0][2]= 4;
points [1][0]= 2;
points [1][1]= 2;
points [1][2]= 2;
int totalPoints = 0;
int totalShots = 0;
[code]...
View Replies
View Related
Apr 7, 2014
I am confused when it is proper to use an application with multiple entry points, or I guess an application with multiple interconnected modules. I have a network application (Netty) as well as a web application (spring). I can bundle them together, in effect tightly coupling them together, or I can modularize them to operate interdependently of each other while still working together to make the application whole.
Is there any specific reason for making an application a single entity vs multiple entities? Is it "desired" to have a self contained application (eg. One main method)?
View Replies
View Related
May 30, 2014
I am trying to uncover why I am getting an error message when trying to view a panoramic photo on my wordpress website.We are using the PTviewer plugin.This is the error message when you load the page: URL....I recently took over as webmaster for this site am not sure how the previous developer decided to set this up.Here is the raw code:
<div style='padding: 15px'><h2 style='font-size: 13pt; color: #DB592D; margin-left: 5px; margin-bottom: 5px; font-family: georgia;'>Spacious One & Two Bedroom Suites</h2><p style="">Stay & Play at Pacific Plaza and your stay will be filled with fun, excitement in a relaxing beach atmosphere.<p style="">Choose from our spacious one bedroom and two bedroom suites.
[code]....
View Replies
View Related
May 5, 2014
I am getting the error message as Exception in thread "main" java.lang.Error: Unresolved compilation problems: NewExcel cannot be resolved to a type for the line NewExcel test = new NewExcel(); in the below code to read the columns from an excelsheet "test.xls". Why I am getting the error message :-
import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class ReadExcel
[Code] .....
View Replies
View Related
May 7, 2015
I can call a child method from a main method. If I have a parent called "Assessment", a child called "Quiz", and another child called "test". Can I instantiate an object like Assessment a = new test(); and call a method in test.
I know the method can be called if I instantiate the test t = new test() but that defeats the purpose of inheritance...
View Replies
View Related
Sep 30, 2014
This current one is to calculate a planes holding pattern. I have to write a method to prompt user to enter speed in knots, then it converts it to km/hr. Another method to calc. pattern width using the speed, another method to calc. pattern length, than a main method which would call and print out the speed in knots, speed in km, pattern width and length.My current problem is on the second method. It works in that I can enter the values and it gives me the correct answers, however it's asking me to enter the speed twice, instead of just once. Anything I try just results in errors and won't compile.
import java.util.Scanner ;
//main method
public class TitleRemoved {
public static void main(String[] args) {
double airSpeedKm = airSpeedOts () ;
System.out.println("That speed is " + airSpeedKm + " km/hr.") ;
[code].....
I want my code to not only work, but be organized and easily readable as well, so I want to avoid bad habits.
View Replies
View Related
Apr 16, 2015
I made a guess a number program but I am having issue figuring out a way that when a user enter's in nothing for the program to spit out a message saying "hey entering nothing doesn't work try again" then ask for input. I have done some research and from what I have found is to read the input in as a String rather than int, and use something like Integer.valueOf() to get the integer value but I am completely lost on how to apply that to my program here is my code
//import statements
import java.util.*; //for scanner class
// class beginning
public class Guess {
public static void main(String[] args ) {
//Declare variables area
int guess, secretNumber = (int) (Math.random() * 10 + 1), lowGuess,highGuess;
[Code] ....
View Replies
View Related
Jul 10, 2014
I am trying to encrypt a message using RSA algo but getting the following error:
java.io.StreamCorruptedException: invalid stream header
at java.io.ObjectInputStream.readStreamHeader(ObjectI nputStream.java:753)
at java.io.ObjectInputStream.<init>(ObjectInputStream .java:268)
Java Code :
public static final String PUBLIC_KEY_FILE = "C:/TXT.key";
final String originalText = "Text to be encrypted ";
ObjectInputStream inputStream = null;
FileInputStream f= new FileInputStream(PUBLIC_KEY_FILE);
// getting error on the below line
inputStream = new ObjectInputStream(f);
final PublicKey publicKey = (PublicKey) inputStream.readObject();
final byte[] cipherText = encrypt(originalText, publicKey);
View Replies
View Related
Jul 29, 2014
What's wrong with my Java program? When I open it using appletviewer, the applet opens but stays blank and an error message appears in Terminal.
Java Code:
import java.applet.*;
import java.awt.*;
public class DemoColor extends Applet
{
Font littleFont = new Font("Helvetica", Font.ITALIC, 6);
public void paint(Graphics gr)
[Code] ....
Error Message:
Exception in thread "AWT-EventQueue-1" java.lang.IllegalArgumentException: Color parameter outside of expected range: Red Green Blue
at java.awt.Color.testColorValueRange(Color.java:310)
at java.awt.Color.<init>(Color.java:395)
at java.awt.Color.<init>(Color.java:369)
at DemoColor.paint(DemoColor.java:24)
[Code] ....
HTML file:
<HTML>
<APPLET CODE="DemoColor.class" WIDTH = 420 HEIGHT = 300>
</APPLET>
</HTML>
View Replies
View Related