Generic error messages when compiling basic program through mac terminal [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 1 year ago.
Improve this question
I am using linux and emacs, I got a program working fine on one computer but when I try to compile it through my mac terminal it refuses to work, giving an error message that reads as follows:
Jamess-MacBook-Pro:uni_shit James$ javac /Users/James/Desktop/uni_shit/cp4a.java
/Users/James/Desktop/uni_shit/cp4a.java:43: error: class, interface, or enum expected
}
^
1 error
The code is copied and pasted from what was working perfectly. Here is my code:
http://s30.postimg.org/9zmp2rr35/Screen_Shot_2014_10_08_at_18_20_43.png

It looks like you've pasted everything from the terminal running Emacs into the Xcode editor, including the status bar Emacs prints at the bottom (which is not part of your code). Delete everything from -uuu to the end of the file.
In the future, save the file in Emacs (e.g. on a flash drive or online storage) and open it up in Xcode (or whatever editor you choose), rather than copying and pasting. That will cut down on errors like this; and besides, you might have a program longer than one screen some day.
I should add, in case you're interested, that Emacs works fine on Macs too. There's actually a version of it included in OS X, although it's pretty old; for the current version, there are a few options to choose from, of which the most popular seem to be Emacs For OS X and Aquamacs. The main difference is that Aquamacs acts a little more like a Mac app in its handling of keyboard shortcuts and things like that; but the standard one also includes nice Command key shortcuts for a lot of things.

Related

Raspbian JavaFX VERY VERY SLOW

Hello Stackoverflow Community!
I am facing a problem,
when I want to execute my self-written JavaFX runnable Jar file program (it is a Chess game).
When I execute the program it needs about ten seconds to start.
After the start, when I want to select a piece or the menu items there are two possible options:
The Gui freezes completely after startup
I may click on a piece and it needs around 5 sec. to select it and when I want to hover (no self-written event) on the JavaFX menubar, the PI freezes for about 5 sec. and then displays the blue hover color.
I have a Raspberry PI 3.
I have currently installed the Java Environment: ,,openjdk version "1.8.0_40-internal" ($ java -version)
I added manually the JavaFX files (they are not included in this openjdk version) as it is mentioned at:Gluonhq -section 2.1.4
I run the Jar file with: java -jar Chess.jar -> Chess.jar is jar file
The game runs without these errors on Linux Mint (openjdk version "1.8.0_131") and Windows 10.
I don´t know what is the source of the problem. Maybe JavaFX on the PI is simply not a good idea?
Anyway thanks for the help,
Alex
Thanks for your quick answers and suggestions, but today I found the solution (tldr; including images of the meeples lead to exceptions, which lead to a bad performance. Removing the images improved the performance):
#Joe C - with my next question I will specify the problem more clearly ;)
#sillyfly - no but thx. for your answer
#Josê - Yes I tried. The first program I used gave me the same bug, but today I tried another self-written one -> this one worked fine -> see below
The problem was that the PI couldn't render my Meeples (they were basically images). I found this out using the stack trace of the PI. Two days ago I couldn´t access the stack trace, due to an impossibility of exiting the game, now I developed an exit function, and here goes the stack trace. It showed me, that there is a null pointer at com.sun.prism.impl.BaseGraphics.drawTexture(BaseGraphics.java:4000) - this is for rendering Images (as far as I know).
Today I removed my meeple images. I don´t know why the PI can´t render these images but it works fine now :)
-Alex

Java app (Processing IDE) attached window not visible in i3wm, common fixes not working [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 4 years ago.
Improve this question
I've been learning Processing using a book called the Nature of Code with an online editor, but I'd like to develop locally for various reasons.
My operating system is 64-bit Arch Linux with the i3 window manager serving as my primary desktop environment -- here's what I've tried so far:
Both 2.x and 3.x stable releases, plus unstable (latest) versions
OpenJDK-jre, OpenJDK-jdk, JRE Oracle & JDK Oracle for Java 7/8 (tested using ./processing --no-embed after the embedded versions didn't seem to be working)
adding for_window [instance="sun-awt-X11-XFramePeer"] floating enable to .i3/config
installing wmnamehttp://tools.suckless.org/wmname and following instructions verbatim
building i3-quickswitch with python ./setup.py install (activating start sketch yields no errors and Processing's logs seem to indicate everything is working fine, but i3-quickswitch shows no additional windows popping up.
I'm not sure which notifications in my i3-log are relevant to these problems, but you can take a look here to see if any certain fix is indicated. I've narrowed it as much I could; it looks like i3 may be treating the window as a "docked" window, which I assume is separate from a dialog window and treated differently.
Thanks for any fixes, sugesstions and advice! I appreciate your time.
Have you tried the official Arch Linux package for Processing?
In the end, I was able to fix the problem by adding the following code to my ~/.i3/config file:
for_window [instance="sun-awt-X11-XFramePeer"] floating enable
for_window [instance="sun-awt-X11-XDialogPeer"] floating enable
I got it working using the Java(TM) SE Runtime Environment (build 1.8.0_45-b14) and i3 version 4.10.3 with Processing Version 2.2.1.
NOTE: I'm not absolutely sure the sun-awt-X11-XFramePeer is needed for this fix, but it is definitely helpful with other Java programs.

Can I Place a Program Written in the Java Programming Language on the Internet in a Way that Others can Run it for Free Without Security Issues? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I've been going through a very frustrating time trying to distribute my program and I could really use some help.
So it all started a long time ago when I decided to try and teach myself C++. I thought I'd learn by doing by trying to create a text adventure with basic code. I managed to create an executable file that worked and cheerfully submitted it to a website that sometimes hosted content similar to what I created.
My submission was rejected out of hand, as no one wanted to advertise or even open the contents of a link to a file download from an unknown source. I found some information online saying that by using the Java Programming Language, I could run an application from a webpage using something called an "applet" that other people could access.
So I learned a second programming language and some basic html and tried to put my application on a website... Except it turns out that applets are a dying technology that no one trusts and that while it is possible to run a program as an applet (or a java web start application) from a webpage, modern browsers will scream bloody murder at anyone who tries to do so because applets are considered horribly insecure.
This project has now been ongoing in some form or another for over a year at this point, and I am at my wits end. I really, really don't want to have to write my program over again in yet another language just so that I can show it to people without them flipping out and acting like I'm trying to infect them with a virus. Is there any way at all to have people use my Java program for free on the internet in a way that won't give people terrible security messages?
It's not a question of programming language. As long as your goal is to distribute your code (meaning that users have to download your code and run it on their computers) you will face the resistance. I, for one, would not run anything downloaded from internet until I research it and find reputable evidence of it being legit and harmless.
You may want to have it as a web application that runs on your server and gives users options to download results in some acceptable format. PDF is usually considered safe, though it's possible to embed maleware there.
Java EE gives many options for creation of such app, starting with JSP (Java Server Pages) and including more up-to-date ones (JSF and such).

How to keep running a program in Java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I have written some Java code to keep getting some value in other website every 10sec.
And I will keep writing the result to append a txt file.
How can I keep running this code.
Should I run it in some cloud server?
If so, how can I do it.
I just know in Eclipse, I click "run application".
How can I run in other ways(Linux, or without Eclipse)?
Here is what you can do, using a loop, shell script and a cron job to achieve what you need:
Make sure your program has the logic something like an infinite loop to run always.
Then write a shell script to invoke your java program with the necessary arguments.
Make sure that the classpath argument points to the jars that you need.
Make sure that the shell script has necessary linux permissions.
Schedule the script to be invoked by setting up a cron job. You can set the cron condition as per your need.
If you used eclipse, then you probably have created a jar file. In that case to run it outside eclipse:
java -jar <path-to-jar-file.jar>
Make sure you are in the correct folder before running above.
Eclipse is an IDE, meaning it allows you to edit and run code. When you click the Play button to run a project in eclipse, for each of your *.java files in the project workspace, another *.class file gets created. This is your code compiled to something the JVM (Java Virtual Machine) understands, and can be translated into machine languange and be ran.
These .class files can be run from the command line as well:
java myProgram.class
(Assuming you have the JRE in your environment variables). This can be done from any jvm on any platform, as long as your code is designed to be cross platform (Not using Windows specific APIs for example).
To stop the app, you can either implement a method that stops it, or kill its process. As for cloud computing, this is too broad a topic to just shoot you an answer here, but yes, you can run your code on a linux machine for example.

Change Cursor for Netbeans on Linux [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 11 months ago.
Improve this question
I am recently have been successfully installed NetBean 6.8 on Ubuntu Box (10.04).
But the problem is, NetBeans doesn't use the Gnome mouse Cursor by default. instead, It uses some freak mouse cursor that I hate!
So, do you have any idea about how to change the cursor that appears inside netbeans.(I have looked inside tools> options but without any output)
Also I have did:
$ grep -iR cursor *
Binary file var/cache/all-resources.dat matches
Binary file var/cache/all-layers.dat matches
Binary file var/cache/index/s2/javascript/8/1/_0.cfs matches
(note, I didn't talked here about how to change the cursor inside some Java program written in NetBeans)
Thanks in advance.
Here's the right way to do it:
Open a terminal.
sudo update-alternatives --config x-cursor-theme
Pick the choice you want from the list.
This is a Ubuntu bug. The above is the correct workaround.
There is no need to copy files in /usr/share/icons.
I had a similar problem. Following workaround works for me.
In my case, I discovered netbeans uses the first cursor theme in "/usr/share/icons" and ignores whatever I set as cursor theme for the desktop.
Let's say the first cursor theme, which is used by netbeans is "/usr/share/icons/firsttheme" and the theme that I want to use is "/usr/share/icons/mytheme".
To solve the problem I simply copy the content of the "/usr/share/icons/mytheme" into "/usr/share/icons/firsttheme".
Do not forget to backup the original theme before copy!

Categories