I have a java applet (SetWatch.class) which I wish to modify. It only supports an offset of 30 minutes and I want 120. I'd like to parameterise the value eventually, but I'd settle for a hard code value as an interim step. I have decompiled it using the website www. showmycode. com. The class file and the resulting .java file are here:
http://www.edcint.co.nz/tmp/SetWatch/
I have programming skills but not java skills so I am unable to verify if the .java file looks good. So I before I modify it I thought I'd try and compile it.
I am running Fedora 19 and using java-1.7.0-openjdk.
I try a basic
javac SetWatch.java
Which gives:
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable javax
location: class SetWatch
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable sound
location: class SetWatch
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable sampled
location: class SetWatch
SetWatch.java:65: error: cannot find symbol
javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine, audioformat);
^
symbol: variable SourceDataLine
location: class SetWatch
4 errors
So I set about trying to find javax.sound.sampled.DataLine.Info.
I find javax/sound/sampled/DataLine$Info.class inside /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.0.fc19.i386/jre/lib/rt.jar. Close, maybe that will work?
javac -classpath /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.0.fc19.i386/jre/lib/rt.jar SetWatch.java
No. Same errors. So I try unzip /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.60-2.4.5.0.fc19.i386/jre/lib/rt.jar into /tmp (which does seem dodgy to me) and then try
javac -classpath /tmp/javax/sound/sampled SetWatch.java which gives different errors:
SetWatch.java:674: error: cannot access AudioFormat
AudioFormat audioformat;
^
bad class file: /tmp/javax/sound/sampled/AudioFormat.class
class file contains wrong class: javax.sound.sampled.AudioFormat
Please remove or make sure it appears in the correct subdirectory of the classpath.
This looks worse to me like it has sort of worked but caused other problems.
I know I only have javax/sound/sampled/DataLine$Info.class which is not exactly what I want. Where do I get javax.sound.sampled.DataLine.Info from?
I've grepped inside every file from the java RPMs looking for DataLine\.Info but I can not find it.
This is the problem when using a decompiler, you often get junk code in the resultant "source" file. The class literal argument has been mangled:
info =
new javax.sound.sampled.DataLine.Info(javax/sound/sampled/SourceDataLine,
audioformat);
^--------------------------------^
it should be
info =
new javax.sound.sampled.DataLine.Info(javax.sound.sampled.SourceDataLine.class,
audioformat);
Read: DataLine.Info javadoc
Related
I am working with JOGL and it stopped working completely.
These are the errors i get:
Texture01.java:27: error: cannot access WriteCloneable
canvas = new GLCanvas(glcapabilities);
^
class file for com.jogamp.common.type.WriteCloneable not found
.\Texture01_GLEventListener.java:2: error: package com.jogamp.common.nio does not exist
import com.jogamp.common.nio.*;
^
.\Texture01_GLEventListener.java:136: error: cannot find symbol
FloatBuffer fb = Buffers.newDirectFloatBuffer(vertices);
^
symbol: variable Buffers
location: class Texture01_GLEventListener
.\Texture01_GLEventListener.java:163: error: cannot find symbol
IntBuffer ib = Buffers.newDirectIntBuffer(indices);
^
symbol: variable Buffers
location: class Texture01_GLEventListener
4 errors
The Path and Classpath variables are correct, I reinstalled JDK and JOGL2 but still get an error with WriteClonable and com.jogamp.common.nio.*
Any help is appreciated!
I am using Sqoop to try import a sql server table into Hive. The connection string is working correctly but the import is failing. Below is the output. I am getting the same error if I try import into HDFS as well. Does anyone know what the issue might be?
[cloudera#ushydgnadipalvx sqoop]$ sqoop import --connect "jdbc:sqlserver://[server];username=[username];password=[password];database=[dbname]" --table [tablename] --hive-import
Warning: /usr/lib/sqoop/../accumulo does not exist! Accumulo imports will fail.
Please set $ACCUMULO_HOME to the root of your Accumulo installation.
15/07/10 15:31:41 INFO sqoop.Sqoop: Running Sqoop version: 1.4.3-cdh4.7.0
15/07/10 15:31:41 INFO tool.BaseSqoopTool: Using Hive-specific delimiters for output. You can override
15/07/10 15:31:41 INFO tool.BaseSqoopTool: delimiters with --fields-terminated-by, etc.
15/07/10 15:31:41 INFO manager.SqlManager: Using default fetchSize of 1000
15/07/10 15:31:41 INFO tool.CodeGenTool: Beginning code generation
15/07/10 15:31:43 INFO manager.SqlManager: Executing SQL statement: SELECT t.* FROM [SocialDatas] AS t WHERE 1=0
15/07/10 15:31:45 INFO orm.CompilationManager: HADOOP_MAPRED_HOME is /usr/lib/hadoop-0.20-mapreduce
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:206: cannot find symbol
symbol : method readString(java.io.DataInput)
location: class java.lang.String
this.Language = Text.readString(__dataIn);
^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:211: cannot find symbol
symbol : method readString(java.io.DataInput)
location: class java.lang.String
this.Platform = Text.readString(__dataIn);
^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:216: cannot find symbol
symbol : method readString(java.io.DataInput)
location: class java.lang.String
this.Text = Text.readString(__dataIn);
^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:257: cannot find symbol
symbol : method writeString(java.io.DataOutput,java.lang.String)
location: class java.lang.String
Text.writeString(__dataOut, Language);
^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:263: cannot find symbol
symbol : method writeString(java.io.DataOutput,java.lang.String)
location: class java.lang.String
Text.writeString(__dataOut, Platform);
^
/tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java:269: cannot find symbol
symbol : method writeString(java.io.DataOutput,java.lang.String)
location: class java.lang.String
Text.writeString(__dataOut, Text);
^
Note: /tmp/sqoop-cloudera/compile/0159bb09ed314f098b249cb4c7c97130/SocialDatas.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors
15/07/10 15:31:47 ERROR tool.ImportTool: Encountered IOException running import job: java.io.IOException: Error returned by javac
at org.apache.sqoop.orm.CompilationManager.compile(CompilationManager.java:217)
at org.apache.sqoop.tool.CodeGenTool.generateORM(CodeGenTool.java:97)
at org.apache.sqoop.tool.ImportTool.importTable(ImportTool.java:396)
at org.apache.sqoop.tool.ImportTool.run(ImportTool.java:506)
at org.apache.sqoop.Sqoop.run(Sqoop.java:147)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:222)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:231)
at org.apache.sqoop.Sqoop.main(Sqoop.java:240)
Errors in output shown above are due to hadoop jars not being in CLASSPATH. Try to import after setting proper CLASSPATH. Below is example for tcsh shell.
setenv CLASSPATH $HADOOP_HOME/lib/*:$CLASSPATH
The issue turned out to be that I had a column name called "Text" and that was causing the error. I fixed it by renaming my column.
I'm trying to build a ROM for Android and everything is going smooth, but then i added Proximity Wake feature from CM and got this error:
packages/apps/Settings/src/com/android/settings/DisplaySettings.java:148: cannot find symbol symbol :
variable advancedPrefs location: class com.android.settings.DisplaySettings
advancedPrefs.removePreference(findPreference(KEY_PROXIMITY_WAKE)); ^
packages/apps/Settings/src/com/android/settings/DisplaySettings.java:149: cannot find symbol symbol :
variable PROXIMITY_ON_WAKE location: class android.provider.Settings.System
Settings.System.putInt(getContentResolver(), Settings.System.PROXIMITY_ON_WAKE, 1);
^ Note: Some input files use or override a deprecated API. Note: Recompile
with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors
when i open up the file i find this lines:
advancedPrefs.removePreference(findPreference(KEY_PROXIMITY_WAKE));
Settings.System.putInt(getContentResolver(), Settings.System.PROXIMITY_ON_WAKE, 1);
The error states that it cannot find a symbol, what is wrong?
I've decided to tackle Akka... which was going great until compile time :-/ Running Ubuntu by the way.
What I've Done So Far:
Installed JRE and JDK 7
Downloaded/Extracted Akka
Downloaded and Setup Maven
Set up PATH variables etc
All following this tutorial Tutorial
When compiling, I'm getting the following errors
javac -cp lib/scala-library.jar:lib/akka/akka-actor_2.10-2.2.1.jar akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java -Xlint:deprecation
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:8: warning: [deprecation] UntypedActorFactory in akka.actor has been deprecated
import akka.actor.UntypedActorFactory;
^
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:10: error: cannot find symbol
import akka.util.Duration;
^
symbol: class Duration
location: package akka.util
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:56: error: cannot find symbol
private final Duration duration;
^
symbol: class Duration
location: class PiApproximation
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:58: error: cannot find symbol
public PiApproximation(double pi, Duration duration) {
^
symbol: class Duration
location: class PiApproximation
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:67: error: cannot find symbol
public Duration getDuration() {
^
symbol: class Duration
location: class PiApproximation
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:112: warning: [deprecation] Props(Class<? extends Actor>) in Props has been deprecated
workerRouter = this.getContext().actorOf(new Props(Worker.class).withRouter(new RoundRobinRouter(nrOfWorkers)),
^
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:127: error: cannot find symbol
Duration duration = Duration.create(System.currentTimeMillis() - start, TimeUnit.MILLISECONDS);
^
symbol: class Duration
location: class Master
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:127: error: cannot find symbol
Duration duration = Duration.create(System.currentTimeMillis() - start, TimeUnit.MILLISECONDS);
^
symbol: variable Duration
location: class Master
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:158: warning: [deprecation] Props(Class<? extends Actor>) in Props has been deprecated
final ActorRef listener = system.actorOf(new Props(Listener.class), "listener");
^
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:161: warning: [deprecation] UntypedActorFactory in akka.actor has been deprecated
ActorRef master = system.actorOf(new Props(new UntypedActorFactory() {
^
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:161: warning: [deprecation] Props(UntypedActorFactory) in Props has been deprecated
ActorRef master = system.actorOf(new Props(new UntypedActorFactory() {
^
akka-tutorial-first-java/src/main/java/akka/tutorial/first/java/Pi.java:168: error: method tell in class ActorRef cannot be applied to given types;
master.tell(new Calculate());
^
required: Object,ActorRef<br/>
found: Calculate<br/>
reason: actual and formal argument lists differ in length<br/>
7 errors<br/>
5 warnings
I've literally copied ans pasted their final Pi.java file and tried to compile and i'm completely at a loss as how to proceed? :-(
Any ideas would be great.
The best way to get started with Akka is by using Typesafe’s Activator: there are several tutorials in there which show you how to do different things, starting from “Hello Akka” to using advanced Cluster features, you can see the full list here.
That said, your problems come from trying to run a tutorial from the 2.0.2 docs on Akka 2.2.1, which will not work.
I ran the following command to compile a servlet called BeerSelect.java from HeadFirst Servlets and JSP book.
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee>javac
-classpath /common/lib servlet-api.jar:classes: -d classes src/com/example/web/B
eerSelect.java
My servlet-api.jar is located in D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\common\lib
MESSAGE
javac: invalid flag: servlet-api.jar:classes:
Usage: javac <options> <source files> use -help for a list of possible options
Cannot understand how to fix this command and compile the servlet. Doing it for the first time new to servlets.
Then I changed the command to be
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee\WEB-IN
F\src\com\example\web>javac -classpath "D:\Apache Tomcat\apache-tomcat-5.5.36\ap
ache-tomcat-5.5.36\common\lib\servlet-api.jar";classes BeerSelect.java
MESSAGE
BeerSelect.java:3: package com.example.model does not exist
import com.example.model.*;
^
BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:15: cannot find symbol
symbol : class BeerExpert
location: class com.example.web.BeerSelect
BeerExpert be = new BeerExpert();
^
BeerSelect.java:32: cannot find symbol
symbol : variable out
location: class com.example.web.BeerSelect
out.println("<br>try: " + it.next());
^
4 errors
Why cannot it find the com.example.model package ?
IMAGE
It looks like you have three issues with your command: extra spaces, Unix-style pathnames, and missing additional Java source files. Try the following instead:
javac -classpath "D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\common\lib\servlet-api.jar";classes -d classes src\com\example\web\*.java src\com\example\model\*.java
I've removed extra spaces, converted Unix paths to Windows paths, changed the classpath separator from the Unix-style ':' to Windows-style ';', and added your other Java sources - compiling them all together should resolve your first three compiler errors.
As for the last compiler error, that appears to be a genuine source code error - try prepending System. to the out.println("<br>try: " + it.next()); line. (It can also be resolved by a static import, but that would be unconventional.)
D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee>javac -classpath "D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\common\lib\servlet-api.jar";"D:\Apache Tomcat\apache-tomcat-5.5.36\apache-tomcat-5.5.36\webapps\Coffee\WEB-INF\src" WEB-INF\src\com\example\web\BeerSelect.java
This command works and compiles the class BeerSelect.java.