Why I got "package R does not exist" error? - java
I have a small project that I finished couple of months ago, and left it on my git account.
Today I have downloaded this project locally and tried to launch, but got such error
Error:(18, 19) error: package R does not exist
I tried clean and rebuild , but it doesn't helped
my log look like this
Information:Gradle tasks [:app:assembleDebug]
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java
Error:(7, 39) error: cannot find symbol class R
Error:(18, 19) error: package R does not exist
Error:(21, 79) error: package R does not exist
Error:(22, 79) error: package R does not exist
Error:(31, 17) error: package R does not exist
Error:(176, 51) error: package R does not exist
Error:(178, 53) error: package R does not exist
Error:(179, 51) error: package R does not exist
Error:(181, 53) error: package R does not exist
Error:(182, 51) error: package R does not exist
Error:(184, 53) error: package R does not exist
Error:(185, 51) error: package R does not exist
Error:(187, 53) error: package R does not exist
Error:(189, 51) error: package R does not exist
Error:(192, 62) error: package R does not exist
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Information:Total time: 2.421 secs
Information:98 errors
Information:0 warnings
Information:See complete output in console
my compiler error output look like this
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:7: error: cannot find symbol
import com.example.aleksey.videoviewer.R;
^
symbol: class R
location: package com.example.aleksey.videoviewer
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:17: error: cannot find symbol
import com.example.aleksey.videoviewer.R;
^
symbol: class R
location: package com.example.aleksey.videoviewer
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:22: error: cannot find symbol
import com.example.aleksey.videoviewer.R;
^
symbol: class R
location: package com.example.aleksey.videoviewer
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentVideo.java:6: error: cannot find symbol
import com.example.aleksey.videoviewer.R;
^
symbol: class R
location: package com.example.aleksey.videoviewer
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:15: error: cannot find symbol
import com.example.aleksey.videoviewer.R;
^
symbol: class R
location: package com.example.aleksey.videoviewer
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivitySplash.java:12: error: cannot find symbol
import com.example.aleksey.videoviewer.R;
^
symbol: class R
location: package com.example.aleksey.videoviewer
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:7: error: cannot find symbol
import com.example.aleksey.videoviewer.R;
^
symbol: class R
location: package com.example.aleksey.videoviewer
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:18: error: package R does not exist
setTheme(R.style.AppTheme_Dark);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:21: error: package R does not exist
Preference prefShareKey = (Preference) findPreference(getString(R.string.pref_share_key));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:22: error: package R does not exist
Preference prefRateReviewKey = (Preference) findPreference(getString(R.string.pref_rate_review_key));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:31: error: package R does not exist
return R.xml.pref_about;
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:36: error: package R does not exist
if(preference.getKey().equals(getString(R.string.pref_share_key))) {
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:40: error: package R does not exist
getString(R.string.subject));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:41: error: package R does not exist
shareIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.message) +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:42: error: package R does not exist
" " + getString(R.string.googleplay_url));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:43: error: package R does not exist
startActivity(Intent.createChooser(shareIntent, getString(R.string.share_to)));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:44: error: package R does not exist
}else if(preference.getKey().equals(getString(R.string.pref_rate_review_key))) {
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:47: error: package R does not exist
getString(R.string.googleplay_url)));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:56: error: package R does not exist
overridePendingTransition(R.anim.open_main, R.anim.close_next);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityAbout.java:56: error: package R does not exist
overridePendingTransition(R.anim.open_main, R.anim.close_next);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:61: error: package R does not exist
setContentView(R.layout.activity_home);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:63: error: package R does not exist
layoutList = (FrameLayout) findViewById(R.id.fragment_container);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:64: error: package R does not exist
toolbar = (Toolbar) findViewById(R.id.toolbar);
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:70: error: package R does not exist
channelNames = getResources().getStringArray(R.array.channel_names);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:71: error: package R does not exist
channelId = getResources().getStringArray(R.array.channel_id);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:72: error: package R does not exist
videoTypes = getResources().getStringArray(R.array.video_types);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:87: error: package R does not exist
.withHeaderBackground(R.drawable.main_icon)
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:127: error: package R does not exist
.replace(R.id.fragment_container, fragment)
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:133: error: package R does not exist
overridePendingTransition(R.anim.open_next, R.anim.close_main);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:133: error: package R does not exist
overridePendingTransition(R.anim.open_next, R.anim.close_main);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:100: error: package R does not exist
.withName(getString(R.string.about))
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:156: error: package R does not exist
.replace(R.id.fragment_container, fragment)
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:163: error: package R does not exist
Fragment f = getSupportFragmentManager().findFragmentById(R.id.fragment_container);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:186: error: package R does not exist
String.format(getString(R.string.error_player),
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:208: error: package R does not exist
getMenuInflater().inflate(R.menu.activity_home, menu);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:215: error: package R does not exist
case R.id.menuAbout:
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:219: error: package R does not exist
overridePendingTransition(R.anim.open_next, R.anim.close_main);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:219: error: package R does not exist
overridePendingTransition(R.anim.open_next, R.anim.close_main);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/activities/ActivityHome.java:278: error: package R does not exist
(FragmentVideo) getFragmentManager().findFragmentById(R.id.video_fragment_container);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:78: error: package R does not exist
View view = inflater.inflate(R.layout.fragment_video_list, container, false);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:86: error: package R does not exist
view.findViewById(R.id.ultimate_recycler_view);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:87: error: package R does not exist
mLblNoResult = (TextView) view.findViewById(R.id.lblNoResult);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:88: error: package R does not exist
mLytRetry = (LinearLayout) view.findViewById(R.id.lytRetry);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:89: error: package R does not exist
mPrgLoading = (CircleProgressBar) view.findViewById(R.id.prgLoading);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:90: error: package R does not exist
AppCompatButton btnRetry = (AppCompatButton) view.findViewById(R.id.raisedRetry);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:93: error: package R does not exist
mPrgLoading.setColorSchemeResources(R.color.accent_color);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:112: error: package R does not exist
.inflate(R.layout.progressbar, null));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:120: error: package R does not exist
.inflate(R.layout.progressbar, null));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:189: error: package R does not exist
Utils.PARAM_KEY_YOUTUBE + getResources().getString(R.string.youtube_apikey) + "&" +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:198: error: package R does not exist
Utils.PARAM_KEY_YOUTUBE + getResources().getString(R.string.youtube_apikey) + "&" +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:315: error: package R does not exist
msgSnackBar = getResources().getString(R.string.no_internet_connection);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:317: error: package R does not exist
msgSnackBar = getResources().getString(R.string.response_error);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:350: error: package R does not exist
Utils.PARAM_KEY_YOUTUBE+getResources().getString(R.string.youtube_apikey)+"&"+
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:426: error: package R does not exist
msgSnackBar = getResources().getString(R.string.no_internet_connection);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:428: error: package R does not exist
msgSnackBar = getResources().getString(R.string.response_error);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentChannelVideo.java:502: error: package R does not exist
case R.id.raisedRetry:
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/fragments/FragmentVideo.java:21: error: package R does not exist
initialize(getResources().getString(R.string.youtube_apikey), this);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:45: error: package R does not exist
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.adapter_video_list, parent, false);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:74: error: package R does not exist
R.mipmap.empty_photo, R.mipmap.empty_photo));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:74: error: package R does not exist
R.mipmap.empty_photo, R.mipmap.empty_photo));
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:109: error: package R does not exist
txtTitle = (TextView) v.findViewById(R.id.txtTitle);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:110: error: package R does not exist
txtDuration = (TextView) v.findViewById(R.id.txtDuration);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:111: error: package R does not exist
txtPublished = (TextView) v.findViewById(R.id.txtPublishedAt);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/adapters/AdapterList.java:112: error: package R does not exist
imgThumbnail = (ImageView) v.findViewById(R.id.imgThumbnail);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:141: error: package R does not exist
timeAgo = dim + " " + ctx.getResources().getString(R.string.date_util_unit_minutes);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:143: error: package R does not exist
timeAgo = ctx.getResources().getString(R.string.date_util_prefix_about) + " " +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:144: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_hour);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:147: error: package R does not exist
timeAgo = ctx.getResources().getString(R.string.date_util_prefix_about) + " " +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:149: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_hour);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:151: error: package R does not exist
timeAgo = ctx.getResources().getString(R.string.date_util_prefix_about) + " " +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:153: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_hours);
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:158: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_day);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:161: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_days);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:164: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_daya);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:167: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_day);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:169: error: package R does not exist
timeAgo = ctx.getResources().getString(R.string.date_util_prefix_about) + " "+
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:170: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_month);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:178: error: package R does not exist
timeAgo = ctx.getResources().getString(R.string.date_util_prefix_about) + " "+
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:182: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_year);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:184: error: package R does not exist
timeAgo = ctx.getResources().getString(R.string.date_util_prefix_almost) + " 2 " +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:185: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_years);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:187: error: package R does not exist
timeAgo = ctx.getResources().getString(R.string.date_util_prefix_about) + " " +
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:189: error: package R does not exist
ctx.getResources().getString(R.string.date_util_unit_years);
^
/Users/admin/UserData/androidProjects/YoutubeClient/app/src/main/java/com/example/aleksey/videoviewer/activities/utils/Utils.java:192: error: package R does not exist
return timeAgo + " " + ctx.getResources().getString(R.string.date_util_suffix);
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
97 errors
:app:compileDebugJavaWithJavac FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.564 secs
Executing tasks: [:app:generateDebugSources, :app:generateDebugAndroidTestSources,
according to this output
Note: Some input files use or override a deprecated API.
API that I used in this project was deprecated, but how I can know which one and how I can fix it?
Also I have such warning
Invalid VCS root mapping
The directory /Users/admin is registered as a Git root, but no Git repositories were found there.
but I think it is doesn't impact directly to R class error.
What am I doing wrong?
Once it happened to me as well. The reason was I copied a java file from another project and pasted that in project. Then I started getting the error 'R does not exist'. The reason behind that was I copied a java file from different project and in that project R file is available in different package. What I did I just imported the R file that belongs to my package. And done. You need to make sure if you are copying any activity file in you project please update R's package according to your project package.
NOTE: One more thing you can do you just go to the area where all the imports statements available(on the top your java file). Remove import statement for R's file and then import that again. It will import your package R file.Hope it will help you out.
Late to the party, but this just happened to me in Android Studio 3.0 after adding a new activity to my project. Turns out the activity had the wrong package name (d'oh! Not sure if that was my fault or AS's). Correcting the package name at the top of the java file and moving it to the correct folder solved the problem.
Related
Protobuffs import from another project
Project B is trying to import Project A proto file. Project B pom.xml has dependencies for Project A. ProjectB has person.proto syntax = "proto3"; import "projectA/src/main/proto/vehical.proto"; message Person { string name = 1; int32 age = 2; } Project A has vehical.proto syntax = "proto3"; message car{ string model= 1; int32 year= 2; } while compilation getting below error [ERROR] C:\eclipseWorkSpace\TestProto\src\main\proto\person.proto [0:0]: projectA/src/main/proto/vehical.proto: File not found. person.proto: Import "projectA/src/main/proto/vehical.proto" was not found or had errors. Any suggestion on how to resolve this experts?
I figured out I just put import "customer.proto"; in person.proto seems to solved my issue.
Why isn't BufferedImage recognized as a valid symbol? [duplicate]
This question already has answers here: What does a "Cannot find symbol" or "Cannot resolve symbol" error mean? (18 answers) Closed 1 year ago. I was trying to do what was proposed here: Converting Image to Color array The code that I copied: BufferedImage bi = ImageIO.read( new File( "image.png" ) ); int[] data = ( (DataBufferInt) bi.getRaster().getDataBuffer() ).getData(); for ( int i = 0 ; i < data.length ; i++ ) { Color c = new Color(data[i]); // RGB is now accessible as c.getRed(); c.getGreen(); c.getBlue(); } I changed "image.png" to "BA 0091.jpg" in my code. Code: public class BANCPU{ public static void main(String[] Ugh){ BufferedImage bi = ImageIO.read( new File( "BA 0091.jpg" ) ); int[] data = ( (DataBufferInt) bi.getRaster().getDataBuffer() ).getData(); for ( int i = 0 ; i < data.length ; i++ ) { Color c = new Color(data[i]); // RGB is now accessible as c.getRed(); c.getGreen(); c.getBlue(); } } } Errors that I got: File: C:\Users\Ben\Desktop\prgm clas\java junk\BANCPU.java [line: 3] Error: cannot find symbol symbol: class BufferedImage location: class BANCPU File: C:\Users\Ben\Desktop\prgm clas\java junk\BANCPU.java [line: 3] Error: cannot find symbol symbol: variable ImageIO location: class BANCPU File: C:\Users\Ben\Desktop\prgm clas\java junk\BANCPU.java [line: 3] Error: cannot find symbol symbol: class File location: class BANCPU File: C:\Users\Ben\Desktop\prgm clas\java junk\BANCPU.java [line: 4] Error: cannot find symbol symbol: class DataBufferInt location: class BANCPU File: C:\Users\Ben\Desktop\prgm clas\java junk\BANCPU.java [line: 6] Error: cannot find symbol symbol: class Color location: class BANCPU File: C:\Users\Ben\Desktop\prgm clas\java junk\BANCPU.java [line: 6] Error: cannot find symbol symbol: class Color location: class BANCPU
You will need to import a few libraries to make that program work. import java.awt.image.*; import java.awt.*; import java.io.*; import javax.imageio.*; Add those lines to the top of your program and it should work.
Migrating Java/GRPC Application from Maven to Bazel (powered by docker)
I'm trying to migrate my build tool from maven to bazel. I have a java/grpc with a proto file, if I build it with maven all is good, but with bazel I keep facing a problem that happens on the grpc. Maybe my bazel BUILD/WORKSPACE file is not configured properly, I'm not too sure. Any help would be appreciated! Here is my WORKSPACE file: load("#bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") RULES_JVM_EXTERNAL_TAG = "3.0" RULES_JVM_EXTERNAL_SHA = "62133c125bf4109dfd9d2af64830208356ce4ef8b165a6ef15bbff7460b35c3a" http_archive( name = "rules_jvm_external", strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, sha256 = RULES_JVM_EXTERNAL_SHA, url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, ) http_archive( name = "bazel_skylib", sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", ], ) load("#bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") bazel_skylib_workspace() http_archive( name = "rules_proto", sha256 = "73ebe9d15ba42401c785f9d0aeebccd73bd80bf6b8ac78f74996d31f2c0ad7a6", strip_prefix = "rules_proto-2c0468366367d7ed97a1f702f9cd7155ab3f73c5", urls = [ "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/2c0468366367d7ed97a1f702f9cd7155ab3f73c5.tar.gz", "https://github.com/bazelbuild/rules_proto/archive/2c0468366367d7ed97a1f702f9cd7155ab3f73c5.tar.gz", ], ) load("#rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") rules_proto_dependencies() rules_proto_toolchains() http_archive( name = "com_google_protobuf", sha256 = "e11f901c62f6a35e295b7e9c49123a96ef7a47503afd40ed174860ad4c3f294f", strip_prefix = "protobuf-3.10.0", url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.10.0/protobuf-all-3.10.0.tar.gz", ) http_archive( name = "googleapi", sha256 = "51849d3ef693c88eb7692875eb444ef7131502e3fa200f25fc0a37b1e7e55ab5", strip_prefix = "googleapis-a111a53c0c6722afcd793b64724ceef7862db5b9", url = "https://github.com/googleapis/googleapis/archive/a111a53c0c6722afcd793b64724ceef7862db5b9.zip", ) load("#com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") protobuf_deps() load("#rules_jvm_external//:specs.bzl", "maven") load("#rules_jvm_external//:defs.bzl", "artifact", "maven_install") maven_install( artifacts = [ "com.google.cloud:google-cloud-pubsub:1.92.0", "com.google.cloud:google-cloud-storage:1.98.0", "io.grpc:grpc-netty-shaded:1.23.0", "io.grpc:grpc-protobuf:1.23.0", "io.grpc:grpc-stub:1.23.0", "mysql:mysql-connector-java:8.0.17", "com.google.cloud.sql:mysql-socket-factory-connector-j-8:1.0.15", "com.zaxxer:HikariCP:3.3.1", "com.google.inject:guice:4.2.2", "jaxen:jaxen:1.2.0", "org.dom4j:dom4j:2.1.1", "org.slf4j:slf4j-simple:2.0.0-alpha1", "org.slf4j:slf4j-api:2.0.0-alpha1", "log4j:log4j:1.2.17", "com.google.code.gson:gson:2.8.6", "junit:junit:4.13-beta-3", "com.google.protobuf:protobuf-java:3.0.0", "com.google.protobuf:protobuf-java-util:3.0.0", ], override_targets = { "com.google.protobuf:protobuf-java": "#com_google_protobuf//:protobuf_java", }, maven_install_json = "//:maven_install.json", generate_compat_repositories = True, repositories = [ "https://jcenter.bintray.com", ], ) load("#maven//:defs.bzl", "pinned_maven_install") pinned_maven_install() load("#maven//:compat.bzl", "compat_repositories") compat_repositories() maven_install( artifacts = [ maven.artifact( group = "com.google.api.grpc", artifact = "proto-google-common-protos", version = "1.16.0", exclusions = [ maven.exclusion( group = "com.google.protobuf", artifact = "protobuf-java" ) ] ) ], maven_install_json = "//:maven_install.json", generate_compat_repositories = True, repositories = [ "https://maven.google.com", "https://repo1.maven.org/maven2", ], ) load("#maven//:defs.bzl", "pinned_maven_install") pinned_maven_install() load("#maven//:compat.bzl", "compat_repositories") compat_repositories() Here is my BUILD file: package(default_visibility = ["//visibility:public"]) load("#rules_proto//proto:defs.bzl", "proto_library") proto_library( name = "account", srcs = glob(["src/main/proto/account.proto"]), deps = ["#googleapi//google/api:annotations_proto"], ) java_proto_library( name = "account_proto_java", deps = [":account"], ) java_library( name = "AccountService", srcs = glob(["src/main/java/**/*.java"]), resources = glob(["src/main/resources/**"]), deps = [ "#maven//:com_google_cloud_google_cloud_pubsub", "#maven//:com_google_cloud_google_cloud_storage", "#maven//:io_grpc_grpc_netty_shaded", "#maven//:io_grpc_grpc_protobuf", "#maven//:io_grpc_grpc_stub", "#maven//:mysql_mysql_connector_java", "#maven//:com_google_cloud_sql_mysql_socket_factory_connector_j_8", "#maven//:com_zaxxer_HikariCP", "#maven//:com_google_inject_guice", "#maven//:jaxen_jaxen", "#maven//:org_dom4j_dom4j", "#maven//:org_slf4j_slf4j_simple", "#maven//:org_slf4j_slf4j_api", "#maven//:log4j_log4j", "#maven//:com_google_code_gson_gson", "#maven//:junit_junit", "#maven//:com_google_guava_guava", "#maven//:io_grpc_grpc_api", "#maven//:com_google_protobuf_protobuf_java", "#maven//:com_google_protobuf_protobuf_java_util", ":account_proto_java", ], ) I finally run that command: docker run --rm -v /${PWD}:${PWD} -w /${PWD} l.gcr.io/google/bazel:latest build ///... Some issues that occur: I always seem to get an error when it's downloading the resources. Here is an example: WARNING: Download from https://maven.google.com/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found For some reason, it doesn't stop there when the 404 appears, towards the end when it comes to build the proto section. I get this error: ERROR: /c/Users/<username>/projects/Ecommerce-Account-Microservice/BUILD:16:1: Building libAccountService-class.jar (198 source files) failed (Exit 1) src/main/java/com/app/account/GRPCClient.java:7: error: cannot find symbol import com.app.account.services.AccountServiceGrpc; ^ symbol: class AccountServiceGrpc location: package com.app.account.services src/main/java/com/app/account/GRPCClient.java:20: error: package AccountServiceGrpc does not exist private final AccountServiceGrpc.AccountServiceBlockingStub blockingStub; ^ src/main/java/com/app/account/server/services/AccountService.java:24: error: cannot find symbol import com.app.account.services.AccountServiceGrpc; ^ symbol: class AccountServiceGrpc location: package com.app.account.services src/main/java/com/app/account/server/services/AccountService.java:39: error: package AccountServiceGrpc does not exist public class AccountService extends AccountServiceGrpc.AccountServiceImplBase { ^ src/main/java/com/app/account/GRPCClient.java:28: error: cannot find symbol blockingStub = AccountServiceGrpc.newBlockingStub(channel); ^ symbol: variable AccountServiceGrpc location: class GRPCClient src/main/java/com/app/account/server/GrpcServer.java:28: error: no suitable method found for addService(AccountService) .addService(AccountService.getInstance()) ^ method ServerBuilder.addService(ServerServiceDefinition) is not applicable (argument mismatch; AccountService cannot be converted to ServerServiceDefinition) method ServerBuilder.addService(BindableService) is not applicable (argument mismatch; AccountService cannot be converted to BindableService) where CAP#1 is a fresh type-variable: CAP#1 extends ServerBuilder<CAP#1> from capture of ? src/main/java/com/app/account/server/services/AccountService.java:57: error: method does not override or implement a method from a supertype #Override ^ src/main/java/com/app/account/server/services/AccountService.java:65: error: method does not override or implement a method from a supertype #Override ^ src/main/java/com/app/account/server/services/AccountService.java:223: error: method does not override or implement a method from a supertype #Override ^ src/main/java/com/app/account/server/services/AccountService.java:273: error: method does not override or implement a method from a supertype #Override ^ INFO: Elapsed time: 373.098s, Critical Path: 44.04s INFO: 358 processes: 353 processwrapper-sandbox, 5 worker. FAILED: Build did NOT complete successfully FAILED: Build did NOT complete successfully I'm not too sure what is going on or what I'm doing wrong at that point, that's why I'm showing all the code. Thanks a lot! Mark
If you want to use multiple maven_install declarations, you need unique names for each of them. See documentation here. I always seem to get an error when it's downloading the resources. Here is an example: WARNING: Download from https://maven.google.com/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 404 Not Found It looks like you don't actually use maven.google.com for any of the artifacts. Remove that from your maven_install.repositories lists and re-run artifact pinning for them. For the missing GRPC classes, it looks like you're missing a java_grpc_library between java_library and java_proto_library. Example.
"Exception in thread "main" java.lang.NoSuchMethodError "
I was in execution of a java program in order to extract XML files.I received this Run Time Exception when i ran my java program. Please Suggest During Compilation This is the compile time error which i got " GenerateInvoice.java:57: package com.ociweb.xml does not exist import com.ociweb.xml.Version; ^ GenerateInvoice.java:58: package com.ociweb.xml does not exist import com.ociweb.xml.WAX; ^ GenerateInvoice.java:69: package com.ociweb.xml does not exist import com.ociweb.xml.WAX; ^ GenerateInvoice.java:73: cannot resolve symbol symbol : class WAX location: class GenerateInvoice WAX waxDoc = null; ^ GenerateInvoice.java:453: cannot resolve symbol symbol : class WAX location: class GenerateInvoice waxDoc = new WAX("/u01/Output/report/gen_xml/work/" + DIR_NAME + "/" + file_name + "_invoice.xml", Version.V1_0); ^ GenerateInvoice.java:453: cannot resolve symbol symbol : variable Version location: class GenerateInvoice waxDoc = new WAX("/u01/Output/report/gen_xml/work/" + DIR_NAME + "/" + file_name + "_invoice.xml", Version.V1_0); " Then i added a package "wax14_1.0.4.jar". After Running : Exception in thread "main" java.lang.NoSuchMethodError: java.util.regex.Pattern.quote(Ljava/lang/String;)Ljava/lang/String; at com.ociweb.xml.XMLUtil.<clinit>(XMLUtil.java:83) at com.ociweb.xml.ElementMetadata.buildQualifiedName(ElementMetadata.java:155) at com.ociweb.xml.ElementMetadata.<init>(ElementMetadata.java:136) at com.ociweb.xml.WAX.start(WAX.java:829) at com.ociweb.xml.WAX.start(WAX.java:816) at com.ociweb.xml.WAX.start(WAX.java:803)
According to the doc (http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html), that method is available since 1.5. Check if you are running an environment < 1.5. If that's the case, you must use Retroweaver, as explained in the project main page (https://code.google.com/p/waxy/).
Cant compile Netbeans generated .java files into .class on command line
I built my java program as part of a uni assignment and as part of the submission it has to be able to be compiled and run in a DOS window (read Windows command window). The program runs fine in Netbeans but when I copy over all the .java files to a separate folder and try and compile each one I get a huge number of compilation errors. When I created the files in Netbeans, I made them all part of the one package and let Netbeans add a "package *Project_Name*" to the top of each class. The rest is standard java, nothing too complex. ITs my first time using Netbeans (version 7.1.1 is what Im using) and its driving me crazy. I can create a .jar file and I can run that from the command line but I need to be able to show that the source code can be compiled from the command line, and the resulting file(s) can also be run form the command line. Has anyone else had this problem, and if so, how did you overcome it or does anyone know what to do to sort this problem out. I have a feeling its to do with references to other files as most of the errors are related to objects that are created and methods that are invoked from other files. fOr exmaple, I have a Manager.java file that has constructors and methods for a Manager object and then in another file (say Proprety.java) I have code to create a Manager object using the new keyword. The current CLASSPATH Im using is CLASSPATH = .;C:\Program Files\java\jdk1.7.0_03\lib;C:\Program Files\Java\jre6\lib\ext\QTJava.zip; The PATH variable is set up like ...;C:\Program Files\Java\jdk1.7.0_03\bin;C:\Program Files\Java\jre7\bin And thats it. The only libraries Im using are java.util.* and java.io.* All other references are to the class files I created in Netbeans Any help would really be appreicated. Results of SET command: C:\>set ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\Gunit\AppData\Roaming asl.log=Destination=file CLASSPATH=.;C:\Program Files\java\jdk1.7.0_03\lib;C:\Program Files\Java\jre6\lib \ext\QTJava.zip;C:\Estateman CommonProgramFiles=C:\Program Files\Common Files COMPUTERNAME=GUNIT-PC ComSpec=C:\Windows\system32\cmd.exe FP_NO_HOST_CHECK=NO HOMEDRIVE=C: HOMEPATH=\Users\Gunit LOCALAPPDATA=C:\Users\Gunit\AppData\Local LOGONSERVER=\\GUNIT-PC MOZ_PLUGIN_PATH=C:\Program Files\SumatraPDF\ NUMBER_OF_PROCESSORS=2 OS=Windows_NT Path=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\syst em32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v 1.0\;C:\Program Files\Common Files\Acronis\SnapAPI\;c:\Program Files\Microsoft S QL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C: \Program Files\Windows Live\Shared;C:\Program Files\QuickTime\QTSystem\;C:\Progr am Files\Common Files\Avid;Avid;C:\Program Files\doxygen\bin;C:\Program Files\Co mmon Files\Adobe\AGL;C:\Program Files\Java\jdk1.7.0_03\bin;C:\Program Files\Java \jre7\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC PROCESSOR_ARCHITECTURE=x86 PROCESSOR_IDENTIFIER=x86 Family 15 Model 6 Stepping 5, GenuineIntel PROCESSOR_LEVEL=15 PROCESSOR_REVISION=0605 ProgramData=C:\ProgramData ProgramFiles=C:\Program Files PROMPT=$P$G PSModulePath=C:\Windows\system32\WindowsPowerShell\v1.0\Modules\ PUBLIC=C:\Users\Public QTJAVA=C:\Program Files\Java\jre6\lib\ext\QTJava.zip SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\Gunit\AppData\Local\Temp TMP=C:\Users\Gunit\AppData\Local\Temp USERDOMAIN=Gunit-PC USERNAME=Gunit USERPROFILE=C:\Users\Gunit VS100COMNTOOLS=c:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\ windir=C:\Windows Command Im running: C:\Estateman>javac Manager.java Output: Manager.java:33: error: cannot find symbol Property temp0 = new Rental(24,"Bogan Ave","Geelong",3040,"Bob Jones ","0420685765","Victoria","Tues 8am",280.50,"23/4/2012"); ^ symbol: class Property location: class Manager Manager.java:33: error: cannot find symbol Property temp0 = new Rental(24,"Bogan Ave","Geelong",3040,"Bob Jones ","0420685765","Victoria","Tues 8am",280.50,"23/4/2012"); ^ symbol: class Rental location: class Manager Manager.java:34: error: cannot find symbol Property temp1 = new Selling(56,"Maritime Rd","Perth",6000,"Alan Gib s","0400345964","Perth","Wed 3pm",350485.00); ^ symbol: class Property location: class Manager Manager.java:34: error: cannot find symbol Property temp1 = new Selling(56,"Maritime Rd","Perth",6000,"Alan Gib s","0400345964","Perth","Wed 3pm",350485.00); ^ symbol: class Selling location: class Manager Manager.java:35: error: cannot find symbol Property temp2 = new Selling(901,"Preston Rd","Murdoch",6505,"Alan G ibs","0400345964","Perth","Fri 10am",890000.00); ^ symbol: class Property location: class Manager Manager.java:35: error: cannot find symbol Property temp2 = new Selling(901,"Preston Rd","Murdoch",6505,"Alan G ibs","0400345964","Perth","Fri 10am",890000.00); ^ symbol: class Selling location: class Manager Manager.java:36: error: cannot find symbol Property temp3 = new Rental(83,"Joke Way","Murdoch",6505,"Grace Kell y","0123493436","Winthrop","Fri 1pm",475.00,"18/4/2012"); ^ symbol: class Property location: class Manager Manager.java:36: error: cannot find symbol Property temp3 = new Rental(83,"Joke Way","Murdoch",6505,"Grace Kell y","0123493436","Winthrop","Fri 1pm",475.00,"18/4/2012"); ^ symbol: class Rental location: class Manager Manager.java:37: error: cannot find symbol Property temp4 = new Selling(167,"Joke Way","Murdoch",6505,"Bob Jone s","0420685765","Victoria","Sat 3pm","17/5/2012"); ^ symbol: class Property location: class Manager Manager.java:37: error: cannot find symbol Property temp4 = new Selling(167,"Joke Way","Murdoch",6505,"Bob Jone s","0420685765","Victoria","Sat 3pm","17/5/2012"); ^ symbol: class Selling location: class Manager Manager.java:38: error: cannot find symbol Property temp5 = new Selling(2,"Ashbury Lane","Success",6110,"Ian Fi elder","0895484453","Atwell","Mon 11am",900000.00); ^ symbol: class Property location: class Manager Manager.java:38: error: cannot find symbol Property temp5 = new Selling(2,"Ashbury Lane","Success",6110,"Ian Fi elder","0895484453","Atwell","Mon 11am",900000.00); ^ symbol: class Selling location: class Manager Manager.java:54: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:54: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:84: error: cannot find symbol Property temp = new Selling(num,name,sub,code,person,phone,offic e,open,price); ^ symbol: class Property location: class Manager Manager.java:84: error: cannot find symbol Property temp = new Selling(num,name,sub,code,person,phone,offic e,open,price); ^ symbol: class Selling location: class Manager Manager.java:92: error: cannot find symbol Property temp = new Rental(num,name,sub,code,person,phone,of fice,open,price,vacant); ^ symbol: class Property location: class Manager Manager.java:92: error: cannot find symbol Property temp = new Rental(num,name,sub,code,person,phone,of fice,open,price,vacant); ^ symbol: class Rental location: class Manager Manager.java:156: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager Manager.java:156: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager Manager.java:165: error: cannot find symbol Rental rTemp = (Rental)(temp); ^ symbol: class Rental location: class Manager Manager.java:165: error: cannot find symbol Rental rTemp = (Rental)(temp); ^ symbol: class Rental location: class Manager Manager.java:173: error: cannot find symbol Selling sTemp = (Selling)(temp); ^ symbol: class Selling location: class Manager Manager.java:173: error: cannot find symbol Selling sTemp = (Selling)(temp); ^ symbol: class Selling location: class Manager Manager.java:180: error: cannot find symbol Selling sTemp = (Selling)(temp); ^ symbol: class Selling location: class Manager Manager.java:180: error: cannot find symbol Selling sTemp = (Selling)(temp); ^ symbol: class Selling location: class Manager Manager.java:198: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:198: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:199: error: cannot find symbol Property tmp = new Property(); ^ symbol: class Property location: class Manager Manager.java:199: error: cannot find symbol Property tmp = new Property(); ^ symbol: class Property location: class Manager Manager.java:212: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager Manager.java:212: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager Manager.java:238: error: cannot find symbol Property temp = new Property(); ^ symbol: class Property location: class Manager Manager.java:238: error: cannot find symbol Property temp = new Property(); ^ symbol: class Property location: class Manager Manager.java:239: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:239: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:249: error: cannot find symbol ((Property)(properties.get(i))).address.setStreetNum(num); ^ symbol: class Property location: class Manager Manager.java:250: error: cannot find symbol ((Property)(properties.get(i))).address.setStreetName(name); ^ symbol: class Property location: class Manager Manager.java:251: error: cannot find symbol ((Property)(properties.get(i))).address.setSuburb(sub); ^ symbol: class Property location: class Manager Manager.java:252: error: cannot find symbol ((Property)(properties.get(i))).address.setPostCode(code); ^ symbol: class Property location: class Manager Manager.java:266: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:266: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:273: error: cannot find symbol Property temp = new Property(); ^ symbol: class Property location: class Manager Manager.java:273: error: cannot find symbol Property temp = new Property(); ^ symbol: class Property location: class Manager Manager.java:280: error: cannot find symbol ((Property)(properties.get(i))).contact.setContact(name,phone,office ); ^ symbol: class Property location: class Manager Manager.java:296: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager Manager.java:296: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager Manager.java:311: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:311: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:317: error: cannot find symbol Property temp = new Property(); ^ symbol: class Property location: class Manager Manager.java:317: error: cannot find symbol Property temp = new Property(); ^ symbol: class Property location: class Manager Manager.java:320: error: cannot find symbol ((Property)(properties.get(i))).viewing.setTime(time); ^ symbol: class Property location: class Manager Manager.java:332: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:332: error: cannot find symbol Utils u = new Utils(); ^ symbol: class Utils location: class Manager Manager.java:341: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager Manager.java:341: error: cannot find symbol Property temp = (Property)(itr.next()); ^ symbol: class Property location: class Manager 57 errors C:\Estateman> Thanks in advance
Ok, I think, the key here is: I made them all part of the one package and let Netbeans add a "package *Project_Name*" to the top of each class. And your command to compile: javac Manager.java Assuming your package name is projectname. Then Netbeans created a directory projectname and placed all your Java files Manager.java, Property.java, and so on in it. In Java the package structure corresponds directly to the directory structure in your file system. E.g. if you have a class A in package x.y.z then the source code file for class A is in file x\y\z\A.java. So when you copy all your *.java files you have to ensure to also copy the original directory structure. In your case you can copy your classes Manager.java, Property.java, ... to C:\test\projectname. Then in your DOS box cd to this directory and compile your classes with: javac -cp .. Manager.java The meaning of the -cp .. command line option is, that the root of your package/directory structure is one level up at C:\test. Then while compiling Manager.java the Java compiler finds the reference to class Property and it assumes that class Property is in the same package as class Manager. So the compiler is looking for class projectname.Property. With the -cp option pointing to C:\Ε£est, the compiler knows it should look into directory C:\test\projectname. After compiling you can run your program with: java -cp .. projectname.Manager