I am new to Java. I am from .net background.I am trying to setup Sonar server. In one of our training sessions on Sonar, the instructor did the anaysis of solution using pom.xml file and then calling mvn sonar:sonar. I am trying to replicate the entire setup locally.
1. I installed JRE 7. When I run , java -version, it shows,
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
2. I download sonar 3.5 and extracted it to new folder
3. In that folder I installed sonar-runner 2.4
3. setup the path and sonar_runner environment variable
4. downloaded jtds-1.3.1 and placed the jar file in mssql folder of sonar
5. I create database sonar with username and password as sonar
6. changed sonar-runner.properties for sql server connection
7. changed sonar.properties for sql server connection
8. Ran Sonar.bat and found that it created tables in the sql server db. To me the command prompt seems like it is hanging as after creating table graphs, the last line is
Is it supposed to stay like this always or should i closed this command prompt by pressing CTRL+C?
9. Now when i run mvn-sonar:sonar, it says mvn is not recrognizes as internal or external command. A quick search on google showed that I need to install Apache maven something I belive. What is this or how do I solve this issue so that the command mvn sonar:sonar can work?
10. I would like to use c sharp ecosystem plugin. But when I browse to C# Plugin - SonarQube - Codehaus , I am confused as what to select? i.e. version 3.2, 3.1, 3.0
11. So if I do a system restart and everytime I have to use sonar, should i run sonar.bat and then do mvn sonar:sonar after modifying the pom.xml file?
I am assigned with a project that will as the user for the amount of days they would like data entered, then loop asking them for these numbers. once it reaches the entered amount of days it will display a menu for which the user can enter the number they want on the list and it will display the data. the menu has 6 items. Total, Average, Determine if its a Drought, Flood or normal rainfall, highest of data entered, lowest of data entered, and 6 is to quit the program.
So far i have total and average working properly. Still looking at how to display drought, flood, and normal.
Main problems, i cannot get highest and lowest to display correct data.
Also when entering 6, or an invalid menu choice, neither "goodbye" or "invalid choice, choose again" gets printed. Rather the loop for entering data continues.
import java.util.Scanner; public class RainAnalysis { /* * Project 1 This program will analyze the rainfall for the number of days a user inputs. */
public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int numOfDays = 0; double rainfallAmount = 0.0;
[Code] ....
Here is a sample output to show what happens when i put in 6 after the menu is displayed.
also i noticed that it does not say the correct day when displaying the lowest and highest rainfall. this is because i put count, i did not know what else to put in order to get the correct day.
how many days do you want to monitor rainfall?5
Enter the rainfall for day 1.01 Enter the rainfall for day 2.1 Enter the rainfall for day 36 Enter the rainfall for day 43 Enter the rainfall for day 51
Rainfall Data Display Menu: 1 - Display total rainfall. 2 - Display rain average for the period. 3 - Display if drought, flood, or normal conditions. 4 - Display the day and amount of the highest rainfall. 5 - Display the day and amount of the lowest rainfall. 6 - Quit the program.
Enter your choice: 4 Day5 has the highest rainfall with 6.0 inches.
Rainfall Data Display Menu: 1 - Display total rainfall. 2 - Display rain average for the period. 3 - Display if drought, flood, or normal conditions. 4 - Display the day and amount of the highest rainfall. 5 - Display the day and amount of the lowest rainfall. 6 - Quit the program.
Enter your choice: 5 Day5 has the lowest rainfall with 0.1 inches.
Rainfall Data Display Menu: 1 - Display total rainfall. 2 - Display rain average for the period. 3 - Display if drought, flood, or normal conditions. 4 - Display the day and amount of the highest rainfall. 5 - Display the day and amount of the lowest rainfall. 6 - Quit the program.
I am trying to set a picture in the background of my GUI. I had already made the GUI with the all the required buttons and labels. So I was trying to separately make a class which extends JPanel and add a picture to a panel by overriding the paintComponent() method, and then added it to a frame (I did not set the default layout of the frame, so it was the default...), and it worked very fine. Here is the code:
Then I needed to add this panel with background picture to the background frame of my already made frame with all the buttons on it.The layout of the parent frame of my GUI was BorderLayout(50, 50), panels (with buttons) were added to it n the north and south positions.
Then I tried to add a JPanel with the background image to the parent frame (of my GUI), (I wanted it to elapse the entire frame, and come under all the buttons and controls, which were only present in the north and south positions of the border layout), and then the panels holding the buttons to the north and south postions of this panel, everything disappeared.
If I don't do anything except adding this panel with the background image to the parent frame, it only takes up the place not taken up by the two panels on the frame (Border Layout)
how to add this panel to the parent frame of my GUI such that it elapses the entire parent frame's background, and the panels containing the buttons should sit on it.
IMPORTANT PARTS OF CODE:- Java Code: //TOP LEFT PANEL JPanel topleftpanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5)); parentPanel_top.add(topleftpanel); topleftpanel.setOpaque(false);
This doesn't work ... I did not see anything in my TreeView...
Here is the MyCustomTreeCell class:
public class MyCustomTreeCell extends TreeCell<java.nio.file.Path> { private final ImageView icon; public MyCustomTreeCell() { super(); icon = new ImageView();
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
First I was using this way how to get connection and all was fine.
con = DriverManager.getConnection("jdbc:derby:memory:datab;create=true");
But now I have to change it to DataSource and how I find out derby had class ClientDataSource for this but for the hell I can't find out how to setup that virtual DB.
ClientDataSource ds = new ClientDataSource(); con = ds.getConnection();
Code as suggested on the web. It looks like this changes the icon in the window decoration only, which doesn't actually show on my Ubuntu desktop with Unity. What I really want is a custom icon for when I alt-tab through open applications. Currently it shows the default grey question mark. How do I assign an icon to the application.
I've setup an array that I would like to analyze by adding up the contents of each column, however, the out of bounds exception pops up when I try to execute the program. I know the book usually expresses this operation the other way around, where the row is the argument of the first for statement, but I've set my array up where I need to add each row before moving to the next column.
vowelCounter is a 5x3 array.
// Display the line which had the most number of vowels
public static int maxVowelSentence() { int max = 0, sum = 0; int sentence = 1; for (int row = 0; row < vowelCounter.length; row++) { max = vowelCounter[row][0];
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
I was a bit confused of the code generated by the Axis2 Code Gen.
I have created a logIn(String username, String password) method in my service and used Axis2 Code Gen to generate the Stub.
I try to access the logIn method from my Client using the Stub like below:
TestServiceStub stub = new TestServiceStub("http://localhost:8080/axis2/services/TestService"); String test = stub.logIn("user","pass").
but instead of UserName and password as the parameters, the Stub created a Login object as the parameter for the logIn method. like the one below:
stub.logIn(Login login1);
I wanted to try the logIn method by providing a static userName and password but it seems impossible because the Stub changed the parameter for the logIn method.
The code here I have works fine if I just want to ask the user to enter four digits: //java application that asks user to input binary numbers(1 or 0) and convert them to decimal numbers import java.util.Scanner; //program uses class scanner public class binarynumber{
//main method that executes the java application public static void main(String args[]){ //declares variables
int digit; int base=2; int degree; double decimal; int binary_zero=0; int binary_one=1; //create scanner for object input
[code]....
The thing is, I want the java application to input more than four digits for the user and I want it to loop it manytimes f until the user ask it to stop.
I need to create a Java program that takes an input a color code in HSV and outputs the equivalent RGB code and Vice versa.
Example: If you test on the color RED in RGB: Input: (255,0,0) Output: (0,100%,100%) If you test on the color RED in HSV: Input0,100%,100%) Output: (255,0,0)
According to what I read, "when programming in Swing, your GUI creation code should be placed on the Event Dispatch Thread (EDT). This will prevent potential race conditions that could lead to deadlock." (See below for code.)
Why is this? How could making a GUI lead to deadlock?
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); }
I have a assignment in which the code has to scrape a web page for a little bit of data including the link to the next page, follow the link, and do this 100 times. It is scraping all the data correctly, including the link, but it isn't following the link to scrape the data on that next page. Instead, it is displaying the first page's data 100 times. I have the code in a while loop where it reads in one character at a time from the page into a string and then uses pattern matching to get the data and the next link from the string. Then it correctly displays the data and should loop back to connect to that next link and read one character at a time into the string and so on.
I have printed the link to the console and it is good. I don't get any errors. I just can't figure out where exactly the problem is. Here is my code:
I have had to create a text analyser. I have created the program but it is all within the main method. The specification states that I have to have at least two methods within my Program.
import java.io.*; import java.text.SimpleDateFormat; import java.util.*; import javax.swing.*; import javax.swing.filechooser.FileNameExtensionFilter; public class Analyser { public static void main(String[] args) throws FileNotFoundException, UnsupportedEncodingException {
According to what I read, “when programming in Swing, your GUI creation code should be placed on the Event Dispatch Thread (EDT). This will prevent potential race conditions that could lead to deadlock.” (See below for code.)
Why is this? How could making a GUI lead to deadlock?
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); }
Code isn't giving me the output that I want and keeps giving me NaN
What I want -
Enter the A value for the line: 2.45 Enter the B value for the line: 4 Enter the C value for the line: -8 Enter the x coordinate of the point: 2.17 Enter the y coordinate of the point: -4
Distance from the point to the line is: 3.9831092774319026
What I am getting
Distance from the point to the line is: NaN
Here is my code-
Tester-
import java.io.*; import java.util.*; class tester { public static double A; public static double B; public static double C; public static double distance; public static void main(String args[])
How do I get my GUI code into a GUI format? I wrote this put it will not make a GUI image.
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Ofelia_Inventory_4; import java.awt.*; import java.awt.event.*;
I want to execute my jsp code to compare two dates after every 10 seconds if user enter date and current sys date are equal it will send the mail to the user automatically. Below is my jsp code
this if condition i want to check the date after every 10 seconds and when two dates are equal it will send the mail using below mail code
if(ExpcReDt.compareTo(dateStr)>0) { out.println("Expected return date is greater than current date"); } else if(ExpcReDt.compareTo(dateStr)==0)