Can't see why I can't compile this
I can't seem to compile this code, and yet its supposed to because this is how our professor gave it to us on the website. Can anyone tell me what I need to make it compile? Thanks in advance.
ArrayList list = new ArrayList(5);
list.add(0, new Object());
list.add(new Object());
Object object = list.remove(1);
ArrayList<Player> players = new ArrayList<Player>(10);
class Player implements Comparable<Player> {
public int compareTo(Player player) {
class PlayerNameComparator implements Comparator<Player> {
public int compare(Player player1, Player player2) {
class MyStack {
public int tos;
public Comparable list[];
// public ArrayList<Player> list;
public MyStack() {
tos = 0;
list = new Comparable[10];
public Comparable pop() {
tos--;
Comparable comparable = list[tos];
list[tos] = null;
return comparable;
public void push(Comparable element) {
list[tos] = element;
tos++;
public String toString() {
String data = new String();
MyStack temp = new MyStack();
Comparable element = null;
while (this.tos > 0) {
element = this.pop();
temp.push(element);
data = data + element.toString();
while (temp.tos > 0) {
this.push(temp.pop());
}
The compiler always produces helpful messages which describe why text won't compile. If you can't understand them it would be a good idea to post those compiler messages.
Similar Messages
-
why i can't compile this source code??
if i not mistaken the error like this "can't read bla..bla(i din't remember)"
(i've install all the java package..)
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.Date;
import java.util.Hashtable;
* Date Servlet
* This is a simple servlet to demonstrate server-side include
* It returns a string representation of the current time.
* @author Scott Atwood
* @version 1.12, 08/29/97
public class DateServlet extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
Date today = new Date();
res.setContentType("text/plain");
//getOutputStream ni aper?
ServletOutputStream out = res.getOutputStream();
out.println(today.toString());
public String getServletInfo() {
return "Returns a string representation of the current time";Try it again. And this time write down the error message you get so you can ask a coherent question.
-
I can't compile this, why?
I do not possess any means of compiling any .java file that imports javax.* or anything J2SE-related, thus, I have to compile it remotely on a remote host (www.myjavaserver.com), however, for some reason this file will not compile but will not produce any errors, warnings, or any display of any kind - but no .class file is ever found.
import java.io.*, java.util.*, javax.servlet.*, javax.servlet.http.*;
* Borrowed from http://forum.java.sun.com/thread.jspa?threadID=703076
* @access public
* @author Phil Powell
public class RequestParameterResetter extends HttpServletRequestWrapper {
private HttpservletRequest origRequest;
private Map<String, String> parameterMap;
public RequestParameterResetter(HttpServletRequest request) {
super(request);
origRequest = request;
parameterMap = new HashMap<String,String>();
public String setParameter(String key, String value) {
String oldValue = parameterMap.put(key,value);
if (oldValue == null) oldValue = origRequest.getParameter(key);
return oldValue;
public String getParameter(String key) {
String value = parameterMap.get(key);
if (value == null) value = origRequest.getParameter(key);
return value;
}Could someone tell me what I'm missing in order for this to properly compile?
Thanx
PhilSorry I can't do that, as much as I want to. My
computer is very ancient and has too little memory to
run any kind of server program, especially a
Java-related one. I tried with Eclipse a while back
(2 years ago and never figured it out, way too hard
in spite of my PC's inability to interact with it)
nearly destroyed my machine with it.You actually don't need to run any server. You just need to get the .JAR files (you should try to get the same server and version that you deploy on ... but that may not be possible). Then you put them in your Java Classpath, and you will be able to compile (from command line, or whatever). You could then un-install the server if you wanted to...
>
That means I can only compile J2SE formatted classes
remotelyThat would be J2EE. J2SE is the standard edition, where you get the compiler, java.lang.String, java.util.Date, and all the rest of the core stuff. J2EE is the enterprise edition for getting the javax.servlet packages (among others).
More comments on how you might change added as comments in the code...
on www.myjavaserver.com - provided it is
working.
I made the changes necessary and still can't compile
it!
package ppowell;
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
* Borrowed from
m
http://forum.java.sun.com/thread.jspa?threadID=703076
* @version JSDK 1.2
The class is a Java 5.0 class, it won't compile to JSDK 1.2.
Ask myjavaserver.com to see how you can get ahold of the error logs so you can see what messages are generated.
* @author Phil Powell
* @package PPOWELL
public class RequestParameterResetter extends
HttpServletRequestWrapper {
private HttpServletRequest origRequest;
private Map<String, String> parameterMap;//if you want to use non JSE 5.0, then this line should be:
// private Map parameterMap;
>
public
blic RequestParameterResetter(HttpServletRequest
request) {
super(request);
origRequest = request;
parameterMap = new HashMap<String,String>();//if you want to use non JSE 5.0, then this line should be:
// parameterMap = new HashMap();
public String setParameter(String key, String
ring value) {
String oldValue = parameterMap.put(key,value);//if you want to use non JSE 5.0, then this line should be:
// String oldValue = (String) parameterMap.put(key,value);
if (oldValue == null) oldValue = origRequest.getParameter(key);
return oldValue;
public String getParameter(String key) {
String value = parameterMap.get(key);//if you want to use non JSE 5.0, then this line should be:
// String value = (String)parameterMap.get(key);
if (value == null) value =
value = origRequest.getParameter(key);
return value; -
How come I can't compile this file in this folder,but can in others
import java.util.*;
public class AlphabeticComparator
implements Comparator{
public int compare(Object o1, Object o2) {
String s1 = (String)o1;
String s2 = (String)o2;
return s1.toLowerCase().compareTo(
s2.toLowerCase());
this code can be compiled in any folders except
e:\java\
why??? the error is:
--------------------Configuration: j2sdk1.4.0 <Default>--------------------
E:\java\AlphabeticComparator.java:3: AlphabeticComparator should be declared abstract; it does not define compare(java.lang.Object,java.lang.Object) in AlphabeticComparator
public class AlphabeticComparator
^
E:\java\AlphabeticComparator.java:6: inconvertible types
found : Object
required: java.lang.String
String s1 = (String)o1;
^
E:\java\AlphabeticComparator.java:7: inconvertible types
found : Object
required: java.lang.String
String s2 = (String)o2;
^
3 errors
Process completed.It looks like you have a class called "Object" in that same directory that the compiler is using when you use "Object", and then the compiler complains because it wasn't "java.lang.Object". Get rid of it -- you should have called it something else, anyway.
-
I still don't see why i can not download this. It says check my requirements, but i satisfy them
I feel your pain... I can get it to work either.
-
Can someone see why im getting error in this query ?
I had 2 queries , instead of using left join i put them together. Now i get error , can someone just take a look to see if syntax wrong somewhere ?
select * from
select i.ips,
a.ips,
a.question_type,
sum(a.score) score,
p.project_name,
p.project_segment,p.location,p.project_exec_model,
p.project_exec_model||' - '||p.project_config pmodel,
one.score schedule,two.score cost,three.score execution,four.score commercial,
nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0) as total,
(select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips) prev_score,
(select max(createdt) from tbl_risk_answer where (ips,sample_num) in
(select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips) last_dt
from
(select v.project_id,v.ips,v.sample_num,v.question_id,v.header_desc,v.section_area,v.score,
decode(bi_recurse(q.active_question,1,2),2,'OTR','-')||decode(bi_recurse(q.active_question,1,1),1,'ITO','-') question_type
from VW_RISK_SCORE v left join tbl_risk_question q on v.question_id=q.question_id
where (v.project_id,v.sample_num) in
(select project_id,max(sample_num) sample_num from VW_RISK_SCORE group by project_id)
) a,
(select distinct ips from VW_RISK_SCORE) i,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=1 group by ips) one,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=2 group by ips) two,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=3 group by ips) three,
(select ips, sum(score) score from VW_RISK_SCORE where section_area=4 group by ips) four,
tbl_risk_project p
where i.ips=one.ips(+) and i.ips=two.ips(+) and i.ips=three.ips(+) and i.ips=four.ips(+) and ito on scores.ips=ito.ips
and i.ips=p.ips and a.question_type='-ITO' group by i.ips,a.ips, a.question_type, p.project_name, p.project_segment, p.location, p.project_exec_model, p.project_exec_model||' - '||p.project_config, one.score, two.score, three.score, four.score, nvl(one.score,0)+nvl(two.score,0)+nvl(three.score,0)+nvl(four.score,0), (select sum(prev_score) prev from XT_RISK_PAST2 where ips = i.ips), (select max(createdt) from tbl_risk_answer where (ips,sample_num) in
(select ips,max(sample_num) from VW_RISK_SCORE group by ips) and ips=i.ips)
) scores and here is error I get.
ORA-00604: error occurred at recursive SQL level 1
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 12
ORA-00920: invalid relational operator
00604. 00000 - "error occurred at recursive SQL level %s"
*Cause: An error occurred while processing a recursive SQL statement
(a statement applying to internal dictionary tables).
*Action: If the situation described in the next error on the stack
can be corrected, do so; otherwise contact Oracle Support.
Error at Line: 30 Column: 4You would move them to the from-clause, just like one, two, three and four.
Something like:
untested for obvious reasons
select *
from (select i.ips,
a.ips,
a.question_type,
sum(a.score) score,
p.project_name,
p.project_segment,
p.location,
p.project_exec_model,
p.project_exec_model || ' - ' || p.project_config pmodel,
one.score schedule,
two.score cost,
three.score execution,
four.score commercial,
nvl(one.score, 0) + nvl(two.score, 0) + nvl(three.score, 0) +
nvl(four.score, 0) as total,
(select sum(prev_score) prev
from xt_risk_past2
where ips = i.ips) prev_score,
(select max(createdt)
from tbl_risk_answer
where (ips, sample_num) in
(select ips, max(sample_num)
from vw_risk_score
group by ips)
and ips = i.ips) last_dt
from (select v.project_id,
v.ips,
v.sample_num,
v.question_id,
v.header_desc,
v.section_area,
v.score,
decode(bi_recurse(q.active_question, 1, 2),
2,
'OTR',
'-') ||
decode(bi_recurse(q.active_question, 1, 1),
1,
'ITO',
'-') question_type
from vw_risk_score v
left join tbl_risk_question q
on v.question_id = q.question_id
where (v.project_id, v.sample_num) in
(select project_id, max(sample_num) sample_num
from vw_risk_score
group by project_id)) a,
(select distinct ips from vw_risk_score) i,
(select ips, sum(score) score
from vw_risk_score
where section_area = 1
group by ips) one,
(select ips, sum(score) score
from vw_risk_score
where section_area = 2
group by ips) two,
(select ips, sum(score) score
from vw_risk_score
where section_area = 3
group by ips) three,
(select ips, sum(score) score
from vw_risk_score
where section_area = 4
group by ips) four,
tbl_risk_project p
-- moved part I
(select ips,
sum(prev_score) prev
from xt_risk_past2
where ips = i.ips) five --or whatever
-- moved part II
(select ips,
max(createdt) maxcreatedt
from tbl_risk_answer
where (ips, sample_num) in (select ips, max(sample_num)
from vw_risk_score
group by ips)
group by ips) six -- or whatever
where i.ips = one.ips(+)
and i.ips = two.ips(+)
and i.ips = three.ips(+)
and i.ips = four.ips(+)
and i.ips = five.ips -- outerjoin if needed
and i.ips = five.ips -- outerjoin if needed
and ito on scores.ips = ito.ips
and i.ips = p.ips
and a.question_type = '-ITO'
group by i.ips,
a.ips,
a.question_type,
p.project_name,
p.project_segment,
p.location,
p.project_exec_model,
p.project_exec_model || ' - ' || p.project_config,
one.score,
two.score,
three.score,
four.score,
nvl(one.score, 0) + nvl(two.score, 0) +
nvl(three.score, 0) + nvl(four.score, 0),
five.prev,
six.maxcreatedt
) scoresI wonder how all this is going to perform by the way....all those scalar subqueries and outer joins are expensive....
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:1594885400346999596
Read up on Subquery Factoring/WITH-clause, and try to rewrite parts of your query.
http://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:4423923392083 -
Can't compile this code! can't tell why. Error message is below. Thanks
import java.util.*;
public class Library {
private Collection books; //Defining a collection of books here
private Iterator bookIter; //We want to iterate the collection of books here
//Constructor to help us initialize our collection to hold elements of a newly created collection
public Library() {
books = new ArrayList(); //Our collection holds a the newly created collection of type ArrayList (providing storage for books)
books.add(new Book("War and Crime"));
books.add(new Book("The Redeemers"));
public void display() {
bookIter = books.iterator();
while (bookIter.hasNext()) {
Book aBook = (Book)bookIter.next();
System.out.println("Title : " + aBook.ret_title());
public static void main(String args[]) {
display();
class Book {
private String title;
Book(String b_title) {
this.title = b_title;
public String ret_title() {
return this.title;
}THIS IS THE ERROR:
"Library.java" 105 lines, 3597 characters
clio:~/javamachine/learning/topics/utils/Collection (Lord G.) % javac Library.java
Library.java:91: non-static method display() cannot be referenced from a static context
display();
^
1 error
Thanks for helping!
BR,
G-AfricHi folkenf,
I tried what you recommended already but the result was even more timidating.
public static void display()ERROR OUTPUT NOW IS:
Library.java:83: non-static variable bookIter cannot be referenced from a static context
bookIter = books.iterator();
^
Library.java:83: non-static variable books cannot be referenced from a static context
bookIter = books.iterator();
^
Library.java:84: non-static variable bookIter cannot be referenced from a static context
while (bookIter.hasNext()) {
^
Library.java:85: non-static variable bookIter cannot be referenced from a static context
Book aBook = (Book)bookIter.next();
^
4 errors
I fixed this error by making books and bookIter static but now main() complains
of null pointer as shown below:
Runtime error:
Exception in thread "main" java.lang.NullPointerException
at Library.main(Library.java:89)
Thanks!
BR,
G-Afric -
Help! I can't compile this program
I copied the following program from E.Harold's book,Java Network Programming,online edition.The file name is SMTPClient.java.Its function is sending simple mails.
When I compiled the file,there were 6 error messages indicating that the first 6 lines of code were wrong.The reasons are something like "class" or "interface" needed.
Can anybody give me some advice?
Source file:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class SMTPClient extends JFrame {
private JButton sendButton = new JButton("Send Message");
private JLabel fromLabel = new JLabel("From: ");
private JLabel toLabel = new JLabel("To: ");
private JLabel hostLabel = new JLabel("SMTP Server: ");
private JLabel subjectLabel = new JLabel("Subject: ");
private JTextField fromField = new JTextField(40);
private JTextField toField = new JTextField(40);
private JTextField hostField = new JTextField(40);
private JTextField subjectField = new JTextField(40);
private JTextArea message = new JTextArea(40, 72);
private JScrollPane jsp = new JScrollPane(message);
public SMTPClient() {
super("SMTP Client");
Container contentPane = this.getContentPane();
contentPane.setLayout(new BorderLayout());
JPanel labels = new JPanel();
labels.setLayout(new GridLayout(4, 1));
labels.add(hostLabel);
JPanel fields = new JPanel();
fields.setLayout(new GridLayout(4, 1));
String host = System.getProperty("mail.host", "");
hostField.setText(host);
fields.add(hostField);
labels.add(toLabel);
fields.add(toField);
String from = System.getProperty("mail.from", "");
fromField.setText(from);
labels.add(fromLabel);
fields.add(fromField);
labels.add(subjectLabel);
fields.add(subjectField);
Box north = Box.createHorizontalBox();
north.add(labels);
north.add(fields);
contentPane.add(north, BorderLayout.NORTH);
message.setFont(new Font("Monospaced", Font.PLAIN, 12));
contentPane.add(jsp, BorderLayout.CENTER);
JPanel south = new JPanel();
south.setLayout(new FlowLayout(FlowLayout.CENTER));
south.add(sendButton);
sendButton.addActionListener(new SendAction());
contentPane.add(south, BorderLayout.SOUTH);
this.pack();
class SendAction implements ActionListener {
public void actionPerformed(ActionEvent evt) {
try {
Properties props = new Properties();
props.put("mail.host", hostField.getText());
Session mailConnection = Session.getInstance(props, null);
final Message msg = new MimeMessage(mailConnection);
Address to = new InternetAddress(toField.getText());
Address from = new InternetAddress(fromField.getText());
msg.setContent(message.getText(), "text/plain");
msg.setFrom(from);
msg.setRecipient(Message.RecipientType.TO, to);
msg.setSubject(subjectField.getText());
// This can take a non-trivial amount of time so
// spawn a thread to handle it.
Runnable r = new Runnable() {
public void run() {
try {
Transport.send(msg);
catch (Exception ex) {
ex.printStackTrace();
Thread t = new Thread(r);
t.start();
message.setText("");
catch (Exception ex) {
// I should really bring up a more specific error dialog here.
ex.printStackTrace();
public static void main(String[] args) {
SMTPClient client = new SMTPClient();
// Next line requires Java 1.3 or later. I want to set up the
// exit behavior here rather than in the constructor since
// other programs that use this class may not want to exit
// the application when the SMTPClient window closes.
client.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
client.show();
Message was edited by:
oscarhua1:install Java SE,set the path variable to the directory of the bin folder(including bin).
2:download the JavaMail 1.4 release from http://java.sun.com/products/javamail/downloads/index.html
3:extract the downloaded file to any location and add the directory of its mail.jar file to classpath.
4:download the JavaBeans Activation Framework 1.1release from
http://java.sun.com/products/javabeans/jaf/downloads/index.html#download
5:extract the downloaded file to any location and add the directory of its activation.jar file to classpath.
then everything goes smoothly
You inspired me and voronetskyy told me exactly what to do,so thak both of you again!:-)
Message was edited by:
oscarhua -
Hi guys I'm a new Java programmer trying to learn this java thing. Anyway I have two classes in the same directory, class B compiles fine.
Class A have a problem reaching the B file why is this? Code follows.
/* B.java */
public class B
B()
System.out.println("Inside B constructor");
/* A.java */
public class A
A()
System.out.println("Inside A constructor");
public static void main(String[] args)
A a = new A();
B b = new B();
When trying to compile A.java I get this error message.
cannot find symbol
symbol : class B
location : class A
B b = new B();Thank you for responding.
I tried that before and I get the java options messages below.
where options include:
-client to select the "client" VM
-server to select the "server" VM
-hotspot is a synonym for the "client" VM [deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image -
Hi guys,
I am trying to establish development platform for my new website. I installed latest JDK and compiled small program which worked well. Then I installed Apache Tomcat and tried to do a small servlet test. This program is meant to display html test page saying "Hello world!":
public class ServletTest extends HttpServlet
public void doGet(
HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String docType =
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 " +
"Transitional//EN\">\n";
out.println(docType +
"<HTML>\n" +
"<HEAD><TITLE>Hello WWW</TITLE></HEAD>\n" +
"<BODY>\n" +
"<H1>Hello World - Servlet speaking</H1>\n" +
"</BODY></HTML>");
}Then I tried to compile it, but javax.servlet.http package can't be found:
C:\>javac ServletTest.java
ServletTest.java:5: package javax.servlet does not exist
import javax.servlet.*;
^
ServletTest.java:6: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
ServletTest.java:8: cannot find symbol
symbol: class HttpServlet
public class ServletTest extends HttpServlet
^
ServletTest.java:11: cannot find symbol
symbol : class HttpServletRequest
location: class ServletTest
HttpServletRequest request,
^
ServletTest.java:12: cannot find symbol
symbol : class HttpServletResponse
location: class ServletTest
HttpServletResponse response)
^
ServletTest.java:13: cannot find symbol
symbol : class ServletException
location: class ServletTest
throws ServletException, IOException
^
6 errorsMy user/system environment path variable goes to: C:\Program Files\Java\jdk1.6.0_10\bin
My user/system environment classpath variable goes to: C:\Program Files\Java\jdk1.6.0_10\jre\lib
What can cause this problem?Thanks for that...
I found and downloaded: servletapi2_1_1-win.zip file which should contain the classes and source files for the Java Servlet 2.1.1 javax.servlet and javax.servlet.http packages
Zipped folder contains:
api and src folders
in addition to that there are following files in zipped folder: license, readme, servlet.jar
I have extracted all of that into my C:\Program Files\Java\jdk1.6.0_10 folder and then copied servlet.jar into C:\Program Files\Java\jdk1.6.0_10\jre\lib folder
I tried to compile my ServletTest.jar but ther is still same error.
Have I done everything right? -
I'm new to JasperReport. I can't compile this kind of report
Hi, all
I'm trying to create a report using Jasper Report. I already add the needed files into net bean classpath. And the compile task is successful. However when I run it, i meet the following message. And my app stucks there.
net.sf.jasperreports.engine.JRException: Error compiling report java source files : C:\HuongLT\Misc\JavaApplication2\HelloReportWorld_1167289263828_654764.java
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:93)
at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:67)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:190)
at net.sf.jasperreports.engine.design.JRDefaultCompiler.compileReport(JRDefaultCompiler.java:105)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:211)
at net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:144)
at javaapplication2.Main.main(Main.java:44)
Caused by: java.io.IOException: CreateProcess: javac -classpath "C:\Documents and Settings\Administrator\Desktop\jasperreports-1.2.8.jar;C:\Documents and Settings\Administrator\Desktop\commons-digester-1.8.jar;C:\Documents and Settings\Administrator\Desktop\commons-collections-3.2.jar;C:\Documents and Settings\Administrator\Desktop\commons-logging-1.1.jar;C:\Documents and Settings\Administrator\Desktop\commons-beanutils.jar;C:\HuongLT\Misc\JavaApplication2\build\classes" C:\HuongLT\Misc\JavaApplication2\HelloReportWorld_1167289263828_654764.java error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:451)
at java.lang.Runtime.exec(Runtime.java:591)
at java.lang.Runtime.exec(Runtime.java:464)
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:62)
... 6 more
Please help me.
I appreciate very much for your helpSee Here...
iCloud Backup and Restore Overview
http://support.apple.com/kb/HT4859?viewlocale=en_US
And Here...
iCloud Help
http://help.apple.com/icloud/?lang=en -
2 accounts to 1. I was so anxious to set up my new iPad at the store that I accidentally set up a new Account. With so many people requesting to merge 2 legitimate accounts that they own, I can't understand why Apple is refusng to allow us to do so! This would simplify our lives so much. I have just switched over to Apple products and if I could at least set up both accounts on my iPad it would help -without signing in and out. I could do this on my android.
http://www.apple.com/feedback
-
Can someone else try to compile this and see why the program is returning..
Can someone else try to compile this and see why the program is returning "false" when I try to delete the files on exit (at bottom of code)... I have the source code uploaded to the web as well as my 2 text test files inside a zip file(they need to be unzipped so you can try to test the program) and .class file... the program works the way i want it to, but i just can't seem to delete the 3 temporary files i use... why??? why does it return false???
Thanks in advance,
Disco Hristo
http://www.holytrinity-holycross.org/DiscoHristo/Assemble.java
http://www.holytrinity-holycross.org/DiscoHristo/Assemble.class
http://www.holytrinity-holycross.org/DiscoHristo/tests.zip
* Assemble.java 1.0 02/06/22
* @author Disco Hristo
* @version 1.0
import java.io.*;
import java.lang.*;
import java.util.*;
public class Assemble
public static void main(String args[]) throws IOException
if (args.length > 0) // Checks to see if there are any arguments
printArgumentInfo ();
else // if no arguments run the program
getInput ();
printToFile ();
deleteFiles ();
public static void getInput () throws IOException
// Gets the input and then send it to 3 files according to Tags
File head = new File ("head.chris");
PrintStream headStream = new PrintStream (new FileOutputStream (head));
File body = new File ("body.chris");
PrintStream bodyStream = new PrintStream (new FileOutputStream (body));
File foot = new File ("foot.chris");
PrintStream footStream = new PrintStream (new FileOutputStream (foot));
String input; // String used to store input
File d = new File(".");
String files[] = d.list();
for (int n=0; n!=files.length; n++)
if (files[n].endsWith(".txt") == true)
String fileName = files[n];
BufferedReader in = new BufferedReader (new FileReader(fileName));
while (true)
input = in.readLine();
if (input != null)
input = input.trim();
if (input == null) // if no more input
break;
else if ( (input.compareTo("<HEAD>")) == 0) // if start of <HEAD> text
do
input = in.readLine();
if (input != null)
input = input.trim();
if ( ((input.compareTo("<BODY>")) == 0) ||
((input.compareTo("<FOOT>")) == 0) ||
((input.compareTo("</BODY>")) == 0) ||
((input.compareTo("</FOOT>")) == 0) ||
((input.compareTo("<HEAD>")) == 0))
//checks to see if tags in input are in correct order
System.out.println("Input Is Incorrectly Formatted - Tag Error");
System.out.println("Close your <HEAD> tag before starting another tag.");
System.exit(1); //exit program without printing data
if ( (input.compareTo("</HEAD>")) != 0) //if not end of tag
headStream.println(input); //print to text file
while ( (input.compareTo("</HEAD>")) != 0);
else if ( (input.compareTo("<BODY>")) == 0) // if start of <BODY> text
do
input = in.readLine();
if (input != null)
input = input.trim();
if ( ((input.compareTo("<HEAD>")) == 0) ||
((input.compareTo("<FOOT>")) == 0) ||
((input.compareTo("</HEAD>")) == 0) ||
((input.compareTo("</FOOT>")) == 0) ||
((input.compareTo("<BODY>")) == 0))
//checks to see if tags in input are in correct order
System.out.println("Input Is Incorrectly Formatted - Tag Error");
System.out.println("Close your <BODY> tag before starting another tag.");
System.exit(1); //exit program without printing data
if ( (input.compareTo("</BODY>")) != 0) //if not end of tag
bodyStream.println(input); //print to text file
while ( (input.compareTo("</BODY>")) != 0);
else if ( (input.compareTo("<FOOT>")) == 0) // if start of <FOOT> text
do
input = in.readLine();
if (input != null)
input = input.trim();
if ( ((input.compareTo("<BODY>")) == 0) ||
((input.compareTo("<HEAD>")) == 0) ||
((input.compareTo("</BODY>")) == 0) ||
((input.compareTo("</HEAD>")) == 0) ||
((input.compareTo("<FOOT>")) == 0))
//checks to see if tags in input are in correct order
System.out.println("Input Is Incorrectly Formatted - Tag Error");
System.out.println("Close your <FOOT> tag before starting another tag.");
System.exit(1); //exit program without printing data
if ( (input.compareTo("</FOOT>")) != 0) //if not end of tag
footStream.println(input); //print to text file
while ( (input.compareTo("</FOOT>")) != 0);
else
break;
public static void printToFile () throws IOException
// Prints the text from head.txt, body.txt, and foot.txt to the output.log
File head = new File ("head.chris");
FileReader headReader = new FileReader(head);
BufferedReader inHead = new BufferedReader(headReader);
File body = new File ("body.chris");
FileReader bodyReader = new FileReader(body);
BufferedReader inBody = new BufferedReader(bodyReader);
File foot = new File ("foot.chris");
FileReader footReader = new FileReader(foot);
BufferedReader inFoot = new BufferedReader(footReader);
PrintStream outputStream = new PrintStream (new FileOutputStream (new File("output.log")));
String output; //string used to store output
while (true)
output = inHead.readLine();
if (output == null) //if no more text to get from file
break;
else
outputStream.println(output); // print to output.log
while (true)
output = inBody.readLine();
if (output == null)// if no more text to get from file
break;
else
outputStream.println(output); // print to output.log
while (true)
output = inFoot.readLine();
if (output == null) //if no more text to get from file
break;
else
outputStream.println(output); // print to output.log
//Close up the files
inHead.close ();
inBody.close ();
inFoot.close ();
outputStream.close ();
public static void printArgumentInfo () // Prints argument info to screen
System.out.println("");
System.out.println("Disco Hristo");
System.out.println("");
System.out.println("Assemble.class is a small program that");
System.out.println("takes in as input a body of text and then");
System.out.println("outputs the text in an order according to");
System.out.println("the tags that are placed in the input.");
public static void deleteFiles ()
File deleteHead = new File ("head.chris");
File deleteBody = new File ("body.chris");
File deleteFoot = new File ("foot.chris");
deleteHead.deleteOnExit();
deleteBody.deleteOnExit();
deleteFoot.deleteOnExit();
}I tired your program, it still gives false for files deleted. I tool the same functions you used in your program and ran it. The files get deleted. Tried this :
<pre>
import java.io.*;
import java.lang.*;
import java.util.*;
public class FileTest {
public static void main(String args[]) {
FileTest f = new FileTest();
try {
f.createFile();
f.deleteFile();
} catch(IOException ioe){
System.out.println(ioe.getMessage());
public void createFile() throws IOException {
System.out.println("In create file method...");
File test = new File("test1.txt");
File tst = new File("text2.txt");
PrintStream testStream = new PrintStream (new FileOutputStream (test));
PrintStream tstStream = new PrintStream (new FileOutputStream (tst));
testStream.println("this is a test to delete a file");
tstStream.println("this is the second file created");
testStream.close();
tstStream.close();
public void deleteFile() throws IOException {
File test = new File("test1.txt");
File tst = new File("text2.txt");
System.out.println(test.delete());
System.out.println(tst.delete());
</pre>
Also check the starting and closing braces for your if..else blocks.
-Siva -
Does anyone know why I can't see the timeline audio waveform on sequences inside another sequence in Premiere Pro CS6? Can I fix this?
PERFECT!!! THANK YOU, Ann!!!
-
Why do I have a constant notification on my settings? How do I get rid of it? Looked through everything and can't see why it's there
Restore from a backup will get you some 'other' back.
Still not happy, Restore in iTunes, Setup as new. Sync back personal data using iTunes Tabs
Maybe you are looking for
-
Java plugin doesn't work, even though it's installed correctly and java programs work.
As stated. I have a link in ~/.mozilla/plugin that points to test/jre/plugin/i386/ns7/libjavaplugin_oji.so, which is the java 6 update 21 runtime environment. Java doesn't show in about:plugins, and java applets don't start (firefox suggests to insta
-
Getting Deployment error in Oracle 10g server
Hii while deploying EAR in Oracle Enterprise Manager 10g. I am getting following error message and an resoluation message,which i could not able to proceed further. Deployment Failed : Another operation in progress which prevents your operation from
-
Temperature programmed desorption
Hi, Does anyone have any experiences with temperature programmed desorption spectra taken with Labview? Any help would be appreciated Christian Ammon Christian Ammon Friedrich-Alexander Universitaet Erlangen Physikalische Chemie II Egerlandstrasse 3
-
All of a sudden I am unable to access my college email from any of my apple devices (iPhone, iPad, Macbook Pro). I am able to get access from my husband's HP windows laptop and from a Mac at the college. Any ideas?
-
I am having trouble setting up my e-mail account use MSN Explorer with Outlook e-mail.I talked to the people at T-MOBIL and they are saying it can not be done.I have seen that some of you are doing it with no problems.Can someone tell me what to do?2