简体   繁体   English

Java setShape()方法在命令提示符下给出错误,但在Eclipse上工作正常

[英]Java setShape() method giving error on command prompt but works fine on eclipse

I am trying to change the shape of my main frame using 我正在尝试使用以下方法更改主框架的形状

    frame.setShape(new RoundRectangle2D.Double(1,1,863,590,80,80));

this method is working perfectly on eclipse but when I compile the program using command prompt with javac command it gives me error. 这个方法在eclipse上工作得很好,但是当我使用带有javac命令的命令提示符编译程序时,出现了错误。

Code Snippet 代码段

C:\Users\AbdulMoiz\Desktop\JAVA PROJECT FINAL>javac Main.java
Main.java:40: cannot find symbol
symbol  : method setShape(java.awt.geom.RoundRectangle2D.Double)
location: class javax.swing.JFrame
frame.setShape(new RoundRectangle2D.Double(1,1,863,590,80,80));

Imports 进口货

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.event.*;
import javax.imageio.*;
import java.awt.image.*;
import java.lang.Math;
import java.awt.geom.*;
import java.util.*;

Could be your eclipse isn't using the same compiler version as javac from cmd. 可能是您的Eclipse没有使用与cmd中的javac相同的编译器版本。 you can compare the javac -version result (in cmd) to the version used in the eclipse project properties. 您可以将javac -version结果(以cmd为单位)与eclipse项目属性中使用的版本进行比较。

Apparently JFrame.setShape has been introduced with JDK7 but was not available in JDK6 . 显然JFrame.setShape已随JDK7一起引入,但在JDK6中不可用。 So it looks like you are using eclipse with JDK >= 7, however your command line javac stems from a JDK <= 6. 因此,看起来您正在使用JDK> = 7的eclipse,但是您的命令行javac源自JDK <= 6。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Java:Jar 在命令提示符下没有给出 output 但在 Z6B7B655DD522FAA3F1007 中工作正常 - Java: Jar is not giving output on command prompt but working fine in eclipse jar没有在命令提示符下输出,但在eclipse中工作正常 - jar is not giving output on command prompt but working fine in eclipse Java 代码适用于 Eclipse,但不适用于命令提示符 - Java code works on eclipse but not on command prompt Java线程程序可在Eclipse中运行,但不能在终端/命令提示符下运行 - Java thread program works in Eclipse, but not in terminal / command prompt 第一个 hello world java 程序可以在 Eclipse 中运行,但不能在命令提示符下运行 - Very first hello world java program works in Eclipse but not in command prompt 为什么Java Processbuilder不能在其自己的目录中运行PMCMD(informatica命令),但可以在命令提示符下正常运行 - Why PMCMD (informatica command) is not run by Java Processbuilder from its own directory while it works fine with command prompt Java中的方法在Eclipse中显示错误,可以使用Maven很好地构建 - Method in Java showing error in Eclipse, builds fine with Maven 错误:在 eclipse 和命令提示符下编译时无法找到或加载主类错误但在 intelliJIDEA 中有效 - Error: Could not find or load main class error when compiling in eclipse and command prompt But works in intelliJIDEA System.console()从Eclipse返回null,但命令提示符很好 - System.console() returns null from Eclipse but fine with Command Prompt 如何从命令行运行 java 项目(在 eclipse 中正常工作,gradle) - How to run java project from command line (works fine in eclipse, gradle)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM